Skip to content

[HOLD for payment 2023-11-06] [$500] Chat - Email pattern is not recognized when sending a comment #28629

Closed

Description

@lanitochka17

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:

  1. Go to any report
  2. Type in compose box codeemail@gmail.com (without any space)
  3. Notice the email is not recognized as email link

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?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

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
  • Upwork Job URL: https://www.upwork.com/jobs/~0181685d1a16ff4d31
  • Upwork Job ID: 1708873970110574592
  • Last Price Increase: 2023-10-16
  • Automatic offers:
    • eh2077 | Contributor | 27335685
    • tsa321 | Reporter | 27335687

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 2, 2023
  2. changed the title [-]Chat - Email pattern is not recognized when sending a comment[/-] [+][$500] Chat - Email pattern is not recognized when sending a comment[/+] on Oct 2, 2023
  3. melvin-bot commented on Oct 2, 2023

    @melvin-bot
  4. melvin-bot commented on Oct 2, 2023

    @melvin-bot

    Triggered auto assignment to @Christinadobrzyn (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 2, 2023
  6. melvin-bot commented on Oct 2, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  7. melvin-bot commented on Oct 2, 2023

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee (External)

  8. Christinadobrzyn commented on Oct 2, 2023

    @Christinadobrzyn
    Contributor

    I can reproduce this. Keeping External label.

  9. ZhenjaHorbach commented on Oct 2, 2023

    @ZhenjaHorbach
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue

    Email pattern is not recognized and the email is not always displayed correctly after the tags (<code> in this case)

    What is the root cause of that problem?

    Imperfect regex for autoEmail which we use in common library

    https://github.com/Expensify/expensify-common/blob/ab4895807dd9a26f64bfaee80db15ee2c48a5124/lib/ExpensiMark.js#L127-L135

    What changes do you think we should make in order to solve the problem?

    We can update regex for autoEmail
    For example:

    https://github.com/Expensify/expensify-common/blob/ab4895807dd9a26f64bfaee80db15ee2c48a5124/lib/ExpensiMark.js#L130-L133

    (?![^<]>|[^<>]<\/(?!em)) ([^\w'#%+-`]|||)${CONST.REG_EXP.MARKDOWN_EMAIL}(?!((?:(?!<a).)+)?<\/a>|[^<]*(<\/pre>|<\/code>))

    Screen.Recording.2023-10-02.at.19.23.32.mov
  10. akamefi202 commented on Oct 2, 2023

    @akamefi202
    Contributor

    Proposal

    Please 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, ExpensiMark class of expensify-common repo translates the comment into html text.

    `code`test@test.com
    

    If the user sends above comment, inlineCodeBlock regex processes the text first.

    <code>code</code>test@test.com
    

    Then the regex for autoEmail blocks replacement if the comment contains any tag just before email, only except <em> tag.

    (?![^<]*>|[^<>]*<\\/(?!em))([^\\w'#%+-]|^|<em>)${CONST.REG_EXP.MARKDOWN_EMAIL}(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))
    

    https://github.com/Expensify/expensify-common/blob/ab4895807dd9a26f64bfaee80db15ee2c48a5124/lib/ExpensiMark.js#L130-L134

    What changes do you think we should make in order to solve the problem?

    We need to update the regex for autoEmail to allow </code> & </pre> tag just before email.

    (?![^<]*>|[^<>]*<\\/(?!em|code|pre))([^\\w'#%+-]|^|<em>|<\\/code>|<\\/pre>)${CONST.REG_EXP.MARKDOWN_EMAIL}(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))
    

    I suggest to replace <\\/(?!em) with <\\/(?!em|code|pre).
    In other words, replace (?![^<]*>|[^<>]*<\\/(?!em)) with (?![^<]*>|[^<>]*<\\/(?!em|code|pre)).

    Previous autoEmail regex blocks replacement if the comment contains any closing tag just before email, except </em> tag.
    But the updated regex will allow replacement if the comment contains </em>, </pre>, </code> tag just before email.

    `code`test@test.com => <code>code</code>test@test.com
    

    Previous regex works like above so the email pattern is not recognized.

    `code`test@test.com => <code>code</code><a href="mailto:test@test.com">test@test.com</a>
    

    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

  11. 52 remaining items

  12. changed the title [-][$500] Chat - Email pattern is not recognized when sending a comment[/-] [+][HOLD for payment 2023-11-06] [$500] Chat - Email pattern is not recognized when sending a comment[/+] on Oct 30, 2023
  13. melvin-bot commented on Oct 30, 2023

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on Oct 30, 2023

    @melvin-bot

    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.

    • External issue reporter
    • Contributor that fixed the issue
    • Contributor+ that helped on the issue and/or PR

    For reference, here are some details about the assignees on this issue:

  15. melvin-bot commented on Oct 30, 2023

    @melvin-bot
  16. burczu commented on Oct 31, 2023

    @burczu
    Contributor

    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:

    • [@burczu] The PR that introduced the bug has been identified. Link to the PR: Didn't find any.
    • [@burczu] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: n/a
    • [@burczu] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: n/a
    • [@burczu] Determine if we should create a regression test for this bug. I don't think we need regression tests here - the issue didn't break any crucial flows of the App.
    • [@burczu] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  17. Christinadobrzyn commented on Nov 6, 2023

    @Christinadobrzyn
    Contributor

    hey @burczu or @eh2077, do you have a regression test?

  18. burczu commented on Nov 7, 2023

    @burczu
    Contributor

    @Christinadobrzyn As I wrote in my previous comment:

    I don't think we need regression tests here - the issue didn't break any crucial flows of the App.

  19. Christinadobrzyn commented on Nov 7, 2023

    @Christinadobrzyn
    Contributor

    Payouts due:

    Issue Reporter: $50 @tsa321 (paid through Upwork)
    Contributor: $500 + $250 @burczu (no payment since they are a contractor)
    Contributor+: $500 + $250 @eh2077 (paid through Upwork)

    Eligible for 50% #urgency bonus? Y - based on #28629 (comment)

    Upwork job is here.

  20. Christinadobrzyn commented on Nov 7, 2023

    @Christinadobrzyn
    Contributor

    Paid based on this payment structure. Closing this GH as complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions