-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for payment 2023-11-06] [$500] Chat - Email pattern is not recognized when sending a comment #28629
Comments
Job added to Upwork: https://www.upwork.com/jobs/~0181685d1a16ff4d31 |
Triggered auto assignment to @Christinadobrzyn ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee ( |
I can reproduce this. Keeping External label. |
ProposalPlease re-state the problem that we are trying to solve in this issueEmail pattern is not recognized and the email is not always displayed correctly after the tags ( What is the root cause of that problem?Imperfect regex for autoEmail which we use in common library What changes do you think we should make in order to solve the problem?We can update regex for autoEmail (?![^<]>|[^<>]<\/(?!em)) ([^\\w'#%+-\`]|||
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Email pattern is not recognized when sending a comment with inline code & email. What is the root cause of that problem?If we send any comment,
If the user sends above comment,
Then the regex for
What changes do you think we should make in order to solve the problem?We need to update the regex for
I suggest to replace Previous
Previous regex works like above so the email pattern is not recognized.
But updated regex will work like above so the email pattern will be recognized successfully. I've confirmed that this fix is working well without any regression by jest testing. What alternative solutions did you explore? (Optional)N/A |
reviewing proposals |
@jjcoffee, @Christinadobrzyn Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@ZhenjaHorbach @akamefi202 Could you add extra detail to your proposals explaining what you're proposing to add to the regex and why it works? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@jjcoffee I updated the proposal with more details. Please review again. |
hey @jjcoffee could you check out the revised proposal #28629 (comment) Or let me know if you'd like to see more proposals. |
@Christinadobrzyn Sorry I haven't had a chance to test the updated proposal properly yet. I will add it to my list for Monday! |
ProposalPlease re-state the problem that we are trying to solve in this issue.Email pattern is not recognized when sending a comment. What is the root cause of that problem?Click to see RCAThe root cause of this issue is that the regex of `(?![^<]*>|[^<>]*<\\/(?!em))([^\\w'#%+-]|^|<em>)${CONST.REG_EXP.MARKDOWN_EMAIL}(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))`, can't match following intermediate text(with
In the starting negative lookahead group, What changes do you think we should make in order to solve the problem?Click to see the main solution with minimum changeBased on the RCA above, we know that the regex piece <a href="https://staging.new.expensify.com/details/test@expensify.com" target="_blank" rel="noreferrer noopener">https://staging.new.expensify.com/details/test@expensify.com</a> The match we want to skip should contains multiple characters of To this issue, we can improve the regex piece `(?![^<]+>|[^<>]*<\\/(?!em))([^\\w'#%+-]|^|<em>)${CONST.REG_EXP.MARKDOWN_EMAIL}(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))`, And we can pass all test cases of expensify-common lib. What alternative solutions did you explore? (Optional)If we dive deeper into the regex `(?![^<]*>|[^<>]*<\\/(?!em))([^\\w'#%+-]|^|<em>)${CONST.REG_EXP.MARKDOWN_EMAIL}(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))`, we find that the starting negative lookadhead group is redundant because the ending negative lookahead group is already sufficient to skip invalid match. For example, the alternative group, Let's split the regex `(?![^<]*>|[^<>]*<\\/(?!em))([^\\w'#%+-]|^|<em>)${CONST.REG_EXP.MARKDOWN_EMAIL}(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))`, into 4 parts and discuss them one by one.
Combined the above discussion, we can have the simplified regex `([^\\w'#%+-]|^)${CONST.REG_EXP.MARKDOWN_EMAIL}(?!((?:(?!<a).)+)?<\\/a>|[^<>]*<\\/(?!em))` See regex test example compared the current buggy regex Click to see test input and regexOptimised regex /([^\w'#%+-]|^)(?=((?=[\w'#%+-]+(?:\.[\w'#%+-]+)*@)[\w\.'#%+-]{1,64}@(?:(?=[a-z\d]+(?:-+[a-z\d]+)*\.)(?:[a-z\d-]{1,63}\.)+[a-z]{2,63})(?= |_|\b))(?<end>.*))\S{3,254}(?=\k<end>$)(?!((?:(?!<a).)+)?<\/a>|[^<>]*<\/(?!em))/gim Current regex /(?![^<]*>|[^<>]*<\/(?!em))([^\w'#%+-]|^|<em>)(?=((?=[\w'#%+-]+(?:\.[\w'#%+-]+)*@)[\w\.'#%+-]{1,64}@(?:(?=[a-z\d]+(?:-+[a-z\d]+)*\.)(?:[a-z\d-]{1,63}\.)+[a-z]{2,63})(?= |_|\b))(?<end>.*))\S{3,254}(?=\k<end>$)(?!((?:(?!<a).)+)?<\/a>|[^<]*(<\/pre>|<\/code>))/gim Text input
Markdown input Test match email after tags
`code`test@gmail.com
```code block```test@gmail.com
[Google](https://google.com)test@gmail.com
Test match email inside em tag
_test@gmail.com_
_test
test@gmail.com_
Test skip match email inside tags
`test@expensify.com`
```test@expensify.com```
@test@expensify.com
_@username@expensify.com_
Test skip match email inside anchor tag
[https://staging.new.expensify.com/details/test@expensify.com](https://staging.new.expensify.com/details/test@expensify.com)
[test italic style wrap email _test@gmail.com_ inside a link](https://google.com) The optimised regex can fix the issue and pass all tests of Expensify-common. Click to see video demo Click to see demo video0-web.mp4 |
@jjcoffee @Christinadobrzyn this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
📣 @eh2077 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
📣 @tsa321 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
@burczu The PR Expensify/expensify-common#590 of expensify-common is ready for review, thanks! |
The PR Expensify/expensify-common#590 has been approved and merged by the default assigned reviewer. @burczu I raised PR #30260 for App to bump the version of expensify-common. Please help to review it when you're free, thanks! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.92-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-11-06. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue: |
This comment was marked as outdated.
This comment was marked as outdated.
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@Christinadobrzyn As I wrote in my previous comment:
|
Payouts due: Issue Reporter: $50 @tsa321 (paid through Upwork) Eligible for 50% #urgency bonus? Y - based on #28629 (comment) Upwork job is here. |
Paid based on this payment structure. Closing this GH as complete |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
code
email@gmail.com (without any space)Expected Result:
Email pattern should be recognized and become blue link style
Actual Result:
Email pattern is not recognized
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.75-11
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
ios-safari_d.mp4
macos-desktop.mov
mweb_d.mp4
android-native_d.mp4
ios-native_d.mp4
macos-web_d.mp4
Recording.124.mp4
Expensify/Expensify Issue URL:
Issue reported by: @tsa321
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696219306455269
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: