-
Notifications
You must be signed in to change notification settings - Fork 136
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
fix: room chat - whisper displays 1 mention when 2 mentions are send in specific way #804
Conversation
@rojiphil Done |
lib/ExpensiMark.ts
Outdated
@@ -303,7 +303,7 @@ export default class ExpensiMark { | |||
{ | |||
name: 'reportMentions', | |||
|
|||
regex: /(?<![^ \n*~_])(#[\p{Ll}0-9-]{1,99})(?![^<]*(?:<\/pre>|<\/code>|<\/a>))/gimu, | |||
regex: /(?<![^ \n*~_-])(#[\p{Ll}0-9]{1,99})(?![^<]*(?:<\/pre>|<\/code>|<\/a>))/gimu, |
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 remove the minus sign - after 0-9
because it will match any word containing minus sign - meaning
If we not remove the minus sign -
and we type #user1-#user2
the output will be:
#user1- #user2
After removing:
#user1 #user2
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 think if we remove the -
minus sign it will cause other issue like:
typing #room-test
the mention-report tag will only wrap #room
But if we don't remove the -
minus sign it will show like this #user1- #user2
if we type #user1-#user2
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.
Tests are failling actually
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.
Yes because the minus sign is removed after 0-9
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.
Yes because the minus sign is removed after
0-9
@NJ-2020 It does not look correct to remove the hyphen.
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.
Yeah, that makes sense.
Ah! So, we can ignore |
Sorry for the delay expensify-common/lib/ExpensiMark.ts Line 306 in e97172c
Just to make sure? |
yes. That's correct. Also, we should revert the change here as that's expected. |
Done |
@NJ-2020 The tests are failing. Did we break anything? Please check. |
Ah!, I know why we include the underscore inside the reportMentions regex, we include the underscore because we want to allow user to type italic room name expensify-common/__tests__/ExpensiMark-HTML-test.js Lines 2266 to 2269 in f11184e
expensify-common/__tests__/ExpensiMark-HTML-test.js Lines 2285 to 2287 in f11184e
As we can see the expected result if we put the underscore before and after the room name it should show in italic way i.e _#room_ should show #room
|
Ah that makes sense, let me investigate a little then I will get back to this. |
@rlinoz Sorry for the delayed response. I just tried the regex and here are the results. Looks fine to me. |
@rlinoz Sorry for the delay
I think it will not fix the issue, because it will match any room name if they are preceded by newline/space, so when we type expensify-common/__tests__/ExpensiMark-HTML-test.js Lines 2266 to 2269 in f11184e
expensify-common/__tests__/ExpensiMark-HTML-test.js Lines 2285 to 2287 in f11184e
But I don't know why when I tested inside the regexr website it matches the room name Please let me know if I miss something here |
@NJ-2020 ah yeah, you are right, that is because there was a mistake not accounting for special characters at the beginning of the line, thats why tests passed but your test on Chrome didn't work, we have no test where special characters are at the beginning I guess I think this new one should do it:
|
@rojiphil Yes, Looks good to me |
Sorry ^ accidently mistaken, I meant @rlinoz |
@NJ-2020 On making the regex changes directly in 46299-background-issue.mp4 |
@rojiphil It's because we did not update the react-native-live-markdown/parser |
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 because we did not update the react-native-live-markdown/parser
Ah ok. Got it. Thanks. Changes LGTM.
Since the version of expensify-common
in latest E/App main is 2.0.94
whereas the latest version of expensify-common
is 2.0.99
we can get this merged first as the changes will not be reflected in latest E/App main until we bump up the version there.
And the next PR would be as mentioned above. Finally, PR on E/App would be raised to update the Does this sound like the plan for us? |
@rlinoz Over to you for final review. |
🚀Published to npm in v2.0.100 |
Fixed Issues
$ Expensify/App#46299
PROPOSAL: Expensify/App#46299 (comment)
Tests
#user1-#user2
QA
Details
Tests
#user1-#user2
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop