-
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
Update regex to split leftword and prefix to highlight #17551
Conversation
@PauloGasparSv @Santhosh-Sellavel 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] |
Reviewer Checklist
Screenshots/VideosWebWeb.movMobile Web - ChromeScreen.Recording.2023-04-24.at.16.14.13.movMobile Web - Safariios.mWeb.movDesktopDesktop.moviOSScreen.Recording.2023-04-24.at.16.20.44.movAndroidAndroid.mov |
src/CONST.js
Outdated
@@ -991,7 +991,7 @@ const CONST = { | |||
CODE_2FA: /^\d{6}$/, | |||
ATTACHMENT_ID: /chat-attachments\/(\d+)/, | |||
HAS_COLON_ONLY_AT_THE_BEGINNING: /^:[^:]+$/, | |||
NEW_LINE_OR_WHITE_SPACE: /[\n\s]/g, | |||
NEW_LINE_OR_WHITE_SPACE_OR_EMOJI: /([\uD800-\uDBFF][\uDC00-\uDFFF]|[\n\s])/g, |
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.
Hey @dukenv0307 I was curious in the proposal too about this, how did you come up with this regex?
I tried searching the web real quick here and didn't find a standard regex for checking for emojis
Hey @dukenv0307 I think the feature isn't working correctly for some emojis (e.g. the spider web 🕸️ and spider 🕷️) , can you take a look at that? Screen.Recording.2023-04-18.at.15.29.59.mov |
Can you remove |
@PauloGasparSv @Santhosh-Sellavel I see that we just had a regex to check emojis Line 922 in f54a8bd
I just updated my PR to use above regex and test again with :spider and :spider_web, It works well |
// eslint-disable-next-line no-misleading-character-class | ||
NEW_LINE_OR_WHITE_SPACE_OR_EMOJI: /[\n\s\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu, |
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.
Can't we substitute the variable instead of copy-paste two to avoid repeating Regex twice?
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.
@Santhosh-Sellavel To resolve this problem, we can create new function to concat regex like this or we can split multiple time like this
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.
It's confusing, please check how URL regex is formed here https://github.com/Expensify/expensify-common/blob/main/lib/Url.js
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.
Thanks for pointing out that, in this PR, we need to insert \n\s (new line or space) to the checking emojis regex. So there are some problems, and I am trying to fix it
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.
Cool, keep us updated
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.
@Santhosh-Sellavel I just updated, help to review
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.
Also tested again. It works well
src/CONST.js
Outdated
// eslint-disable-next-line max-len, no-misleading-character-class | ||
EMOJIS: /[\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu, | ||
// eslint-disable-next-line no-misleading-character-class | ||
EMOJIS: new RegExp(`${EMOJIS.source}`, 'g'), |
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.
@dukenv0307 Unable to run Desktop App |
I changed the PR to:
It worked well on web/mweb/desktop, but I found the error on IOS native Do you have any ideas @Santhosh-Sellavel ? |
Looking back It's not a big thing to me, can we just revert back to where it was working? We don't want to make everything reusable. @PauloGasparSv Are you fine with this? |
@Santhosh-Sellavel @PauloGasparSv I just reverted back and the current code works well on all platforms. |
Can you guys test if the feature is working for you? I think it's broken here and the search only opens for the first emoji you type @dukenv0307 : / Screen.Recording.2023-04-23.at.11.11.56.mov |
This step could be improved
Go to any report, and try to add emoji using shorthand suggestions. Ex: |
Reviewer Checklist
Screenshots/VideosWeb & DesktopScreen.Recording.2023-04-24.at.11.55.50.PM.movMobile Web - ChromeEmoji_HIgh_mweb.mp4Mobile Web - Safari & iOSSimulator.Screen.Recording.-.iPhone.14.-.2023-04-25.at.00.12.32.mp4AndroidScreen_Recording_20230425_001412_New.Expensify.1.mp4 |
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 tests well!
Waiting for a small update on test steps here but not a blocker. So approving all you @PauloGasparSv
@PauloGasparSv I think the checklist failing this comment #17551 (comment) Can remove this one or fill it thanks! |
I'm testing all platforms here so I'll fill it in a bit : ) |
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!
I also agree we should change the steps to explicitly mention the user needs to type in the word after a colon* : ) I'll merge it already! |
@PauloGasparSv It's colon not comma 😄 |
hahahaha you are right, sorry! |
✋ 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/PauloGasparSv in version: 1.3.5-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.5-6 🚀
|
Details
The emoji suggestion is not highlighted if the cursor is before another emoji and the emoji suggestion is not displayed when before is another emoji. To fix it we update regex to split left word and prefix to highlight
Fixed Issues
$ #16626
PROPOSAL: #16626 (comment)
Tests
Offline tests
Same above
QA Steps
PR 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-04-18.at.08.39.30.mov
Mobile Web - Chrome
Screen.Recording.2023-04-18.at.08.41.17.mov
Mobile Web - Safari
Screen.Recording.2023-04-18.at.08.43.59.mov
Desktop
Screen.Recording.2023-04-18.at.08.46.35.mov
iOS
Screen.Recording.2023-04-18.at.09.04.51.mp4
Android
Screen.Recording.2023-04-18.at.09.45.27.mp4