-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update mention replacer regex #19004
Conversation
@Beamanator @mananjadhav One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
src/CONST.js
Outdated
@@ -1027,7 +1027,7 @@ const CONST = { | |||
EMOJI_REPLACER: /^:[^\n\r]+?(?=$|\s)/, | |||
|
|||
// Define the regular expression pattern to match a string starting with an at sign and ending with a space or newline character | |||
MENTION_REPLACER: /^@[^\n\r]*?(?=$|\s)/, | |||
MENTION_REPLACER: /^@[^\n\r]*?(?=$|[\s\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering what's the difference between this and other regex for Emojis. @allroundexperts can you please elaborate on the need for a new regex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@allroundexperts did you get a chance to look at this comment?
cc - @Beamanator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mananjadhav Thanks for the reminder. I was actually holding it off until this thread resolves. But I guess its taking time so I'll just proceed with this PR.
I used a new regex because of no particular reason. I agree that we should just re-use the one we have already. I'll replace this.
@mananjadhav I've updated the regex such that it also includes the use case defined here. |
b9cfe67
to
bfa2079
Compare
@allroundexperts it looks like we're using the same PR to fix two similar issues? Can we update the test steps to reflect that please? |
@mananjadhav Updated the steps. |
Code is looking good, but @mananjadhav can you complete the checklist & screenshots please? |
I’ll do that today. |
@Beamanator I am just checking linked issue #19338 do we want to fix it here? |
@mananjadhav if this change does fix that issue, great! If it doesn't but it's a super simple fix, I'd say let's go ahead and fix it here 👍 |
@allroundexperts Can you please add a comma to your regex? that should cover the special characters cases for the linked issue. |
@mananjadhav Sure. |
@mananjadhav Updated. |
Reviewer Checklist
Screenshots/VideosWebweb-mention-replace-regex.movMobile Web - Chromemweb-chrome-mention-replace-regex.movMobile Web - Safarimweb-safari-mention-replace-regex.movDesktopdesktop-mention-replace-regex.moviOSios-mention-replace-regex.movAndroidandroid-mention-replace-regex.movMy iOS simulator is running terribly slow. Apologies for the delay. @Beamanator All yours. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💪
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/Beamanator in version: 1.3.18-0 🚀
|
🚀 Deployed to staging by https://github.com/Beamanator in version: 1.3.18-0 🚀
|
🚀 Deployed to staging by https://github.com/Beamanator in version: 1.3.18-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.3.18-2 🚀
|
MENTION_REPLACER: | ||
// eslint-disable-next-line no-misleading-character-class | ||
/^@[^\n\r]*?(?=$|[\s,/?"{}[\]()&^%$#<>!*\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3)/u, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regex caused a regression in #29187 , more details #29187 (comment)
Details
This PR updates the
mention
replacer regex such that it does not replace the emoji's written next to the mention text.Fixed Issues
$ #18867
PROPOSAL: #18867 (comment)
Tests
@a
such that a few mentions are shownOffline tests
N/A
QA Steps
@a
such that a few mentions are shownPR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Screen.Recording.2023-05-16.at.4.20.34.PM.mov
Mobile Web - Chrome
Screen.Recording.2023-05-16.at.4.28.09.PM.mov
Mobile Web - Safari
Screen.Recording.2023-05-16.at.4.26.55.PM.mov
Desktop
Screen.Recording.2023-05-16.at.4.23.48.PM.mov
iOS
Screen.Recording.2023-05-16.at.4.30.37.PM.mov
Android
Screen.Recording.2023-05-16.at.4.36.43.PM.mov