You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-12-28] [$500] Mentioning an email with double @ sign results in an invalid email mention #28946
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: 1.3.78-2 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
changed the title [-] Mentioning an email with double @ sign results in an invalid email mention[/-][+][$500] Mentioning an email with double @ sign results in an invalid email mention[/+]on Oct 5, 2023
This only remove the first @ and the LTR unicode, but in the case of having the double @ it will keep it and causes the navigation link to contain that extra @
What changes do you think we should make in order to solve the problem?
We can use the following regex to remove all the leading @ and correctly calculate the navigation link
Currently, it inputs the whole string inside <mention-user> tag if the string is matched with regex.
So even if the string contains multiple @ characters at the first, <mention-user> tag will include all those @ characters too.
That's why the app shows invalid email with @ characters at first, on the mentioned email.
What changes do you think we should make in order to solve the problem?
We need to update replace regex of userMentions to input only one @ character inside <mention-user> tag.
Rest of @ characters should stay outside of <mention-user> tag.
Please re-state the problem that we are trying to solve in this issue.
Mentioning an email with double @ sign results in an invalid email mention
What is the root cause of that problem?
We're matching multiple @ signs in the regex of user mentions rule in ExpensiMark i.e. the @+ in the @+${CONST.REG_EXP.EMAIL_PART} section matches one or more @ symbols.
I looked through the merged PRs dealing with mentions, and I didn't find any that added the +. It's possible it may have always been there from the beginning.
EDIT: Specified what the PRs I looked at dealt with.
Bug: Mentioning an email with double @ sign results in an invalid email mention
Steps:
Log into an account and open a report
Type '@' in the composer followed by the valid email of someone you've chatted with before. You can also optionally select one from the mentions' suggestions list.
Place the cursor at the beginning of the composer, type another '@' sign, and then send the message.
Verify that only the first '@' sign before the email and the email is highlighted e.g. @@user@expensify.com.
Repeat step 2 and then send the message.
Verify that a regular mention with one '@' sign works as usual.
Activity
[-] Mentioning an email with double @ sign results in an invalid email mention[/-][+][$500] Mentioning an email with double @ sign results in an invalid email mention[/+]melvin-bot commentedon Oct 5, 2023
Job added to Upwork: https://www.upwork.com/jobs/~016783de9809fcb5bd
melvin-bot commentedon Oct 5, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (
External)abdel-h66 commentedon Oct 5, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Mentions with Double leading
@redirect to the wrong routeWhat is the root cause of that problem?
To correctly calculate the display name or the login of the mentioned user, we only remove the leading
@using
App/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js
Lines 45 to 50 in 8d42ad3
This only remove the first
@and the LTR unicode, but in the case of having the double@it will keep it and causes the navigation link to contain that extra@What changes do you think we should make in order to solve the problem?
We can use the following regex to remove all the leading @ and correctly calculate the navigation link
Test 1: Removing multiple leading
@charactersTest 2: Removing one leading
@characterWhat alternative solutions did you explore? (Optional)
N/A
akamefi202 commentedon Oct 5, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Mentioning an email with double @ sign results in an invalid email mention.
What is the root cause of that problem?
The root cause is replace regex of
userMentionsinExpensiMarkclass ofexpensify-commonrepo.https://github.com/Expensify/expensify-common/blob/bc275547d5e0e36cfd25169bdb6eb0ae3f505bf2/lib/ExpensiMark.js#L111-L120
Currently, it inputs the whole string inside
<mention-user>tag if the string is matched with regex.So even if the string contains multiple
@characters at the first,<mention-user>tag will include all those@characters too.That's why the app shows invalid email with
@characters at first, on the mentioned email.What changes do you think we should make in order to solve the problem?
We need to update replace regex of
userMentionsto input only one@character inside<mention-user>tag.Rest of
@characters should stay outside of<mention-user>tag.As a result, the app will show valid email although the user inputs multiple
@characters at first.What alternative solutions did you explore? (Optional)
N/A
Victor-Nyagudi commentedon Oct 6, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Mentioning an email with double @ sign results in an invalid email mention
What is the root cause of that problem?
We're matching multiple
@signs in theregexof user mentions rule inExpensiMarki.e. the@+in the@+${CONST.REG_EXP.EMAIL_PART}section matches one or more@symbols.What changes do you think we should make in order to solve the problem?
I propose removing the
+after the@symbol so only one@is matched.This is what the regex will capture whenever there are multiple leading
@symbols after this change.@@@
@johnsmith@gmail.comThis behavior is also consistent with what we currently have when there are multiple leading
@symbols for@herementions.Demo after changes
expensify-fix-double-at-symbol-bug-demo.mov
What alternative solutions did you explore? (Optional)
None as of yet.
melvin-bot commentedon Oct 9, 2023
@Santhosh-Sellavel Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Santhosh-Sellavel commentedon Oct 9, 2023
Thanks, @akamefi202 @Victor-Nyagudi Both of your proposals work.
I like your @Victor-Nyagudi as its cleaner and does the job. Wondering why + was added in the first place, are we missing something?
Victor-Nyagudi commentedon Oct 9, 2023
I'm not sure either, @Santhosh-Sellavel.
I looked through the merged PRs dealing with mentions, and I didn't find any that added the
+. It's possible it may have always been there from the beginning.EDIT: Specified what the PRs I looked at dealt with.
116 remaining items
Santhosh-Sellavel commentedon Jan 1, 2024
Bug: Mentioning an email with double @ sign results in an invalid email mention
Steps:
@user@expensify.com.abekkala commentedon Jan 3, 2024
I'm back from ooo, unassigning @kadiealexander and creating regression test GH and payment today
abekkala commentedon Jan 3, 2024
@Victor-Nyagudi payment sent and contract ended - thank you! 🎉
abekkala commentedon Jan 3, 2024
@adeel0202 payment offer sent in Upwork - once accepted, I can process payment
abekkala commentedon Jan 3, 2024
@Santhosh-Sellavel - [$500] to be made via New Dot
adeel0202 commentedon Jan 3, 2024
Thanks. I've accepted.
abekkala commentedon Jan 3, 2024
@adeel0202 payment sent and contract ended - thank you! 🎉
abekkala commentedon Jan 8, 2024
@Santhosh-Sellavel have you requested/received your payment in NewDot?
Santhosh-Sellavel commentedon Jan 10, 2024
Requested on ND
abekkala commentedon Jan 11, 2024
PAYMENTS:
Muhammad Adeel Nawaz paid ✅
Victor-Nyagudi paid ✅
Santosh - requested payment [$500] in ND
JmillsExpensify commentedon Jan 14, 2024
$500 payment approved for @Santhosh-Sellavel based on this comment.