Skip to content

[HOLD for payment 2023-10-27] [$500] App triggers text to link even while save changes on edit message even when no changes is done #29225

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.3.80-1
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
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation:
https://expensify.slack.com/archives/C049HHMV9SM/p1696945742113089

Action Performed:

  1. Open the app
  2. Open any report
  3. Send any link
  4. Edit link and remove circular bracket with text in it and save (if needed, we can also remove square brackets)
  5. Again edit and save without making any changes
  6. Observe that even though no changes are done, app converts text to link

Expected Result:

App should not perform any changes to edit message if message before save and after save is same

Actual Result:

App converts text to link even when there is no change in edit message

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
android.native.text.to.link.even.on.no.change.to.text.mp4
Android: mWeb Chrome
android.chrome.text.to.link.even.on.no.change.to.text.mp4
iOS: Native
ios.native.text.to.link.in.edit.without.any.change.mov
iOS: mWeb Safari
ios.safari.text.to.link.in.edit.without.any.change.mov
MacOS: Chrome / Safari
mac.chrome.text.to.link.on.save.even.without.any.changes.mov
Recording.37.mp4
MacOS: Desktop
mac.desktop.text.to.link.in.edit.without.any.change.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c71d9095a2d85a78
  • Upwork Job ID: 1711828833297678336
  • Last Price Increase: 2023-10-10
  • Automatic offers:
    • eh2077 | Contributor | 27147950
    • dhanashree-sawant | Reporter | 27147951

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 10, 2023
  2. changed the title [-]App triggers text to link even while save changes on edit message even when no changes is done[/-] [+][$500] App triggers text to link even while save changes on edit message even when no changes is done[/+] on Oct 10, 2023
  3. melvin-bot commented on Oct 10, 2023

    @melvin-bot

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

  4. melvin-bot commented on Oct 10, 2023

    @melvin-bot
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 10, 2023
  6. melvin-bot commented on Oct 10, 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 10, 2023

    @melvin-bot

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

  8. offroader commented on Oct 10, 2023

    @offroader

    Proposal

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

    When you explicitly remove a link from message and then try to edit message but save it without making any changes, app adds links again

    What is the root cause of that problem?

    We detect purposely removed links in this line

    const htmlForNewComment = handleUserDeletedLinksInHtml(textForNewComment, originalCommentHTML);

    Then compare generated html vs original one, but the new html will always be different in our case

    App/src/libs/actions/Report.js

    Lines 1197 to 1200 in b5445bd

    // Skip the Edit if message is not changed
    if (parsedOriginalCommentHTML === htmlForNewComment.trim() || originalCommentHTML === htmlForNewComment.trim()) {
    return;
    }

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

    Compare parsed original message to the new comment text as well (additional condition into the following if statement):

    // Skip the Edit if message is not changed
    if (parsedOriginalCommentHTML === htmlForNewComment.trim() || originalCommentHTML === htmlForNewComment.trim() || parsedOriginalCommentHTML === textForNewComment) {
        return;
    }
    
  9. parasharrajat commented on Oct 11, 2023

    @parasharrajat
    Member

    This is expected behavior as per #13551. It should have to be detected while comparing regression steps #13551.

    cc: @m-natarajan Do we not check issues against existing regression steps before exporting? If, not. This is something that we should propose into the process.

  10. offroader commented on Oct 11, 2023

    @offroader

    @parasharrajat this issue means when you open edit input and save without any changes. Can you confirm that this is expected?
    See demo video (current behavior):

    current.mp4

    After my suggested changes:

    demo.mp4

    So if you edit comment it will autolink again.

  11. eh2077 commented on Oct 11, 2023

    @eh2077
    Contributor

    Proposal

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

    App triggers text to link even while save changes on edit message even when no changes is done.

    What is the root cause of that problem?

    The root cause of this issue is that we call method Report.editReportComment to save draft without checking if the draft is changed from the very initial draft, parser.htmlToMarkdown(lodashGet(props.action, 'message[0].html')).trim(), or not, see here.

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

    To fix this issue, we only save draft when it's different from the initial draft, parser.htmlToMarkdown(lodashGet(props.action, 'message[0].html')).trim(). We can change this line to

            const parser = new ExpensiMark();
            if (trimmedNewDraft !== parser.htmlToMarkdown(lodashGet(props.action, 'message[0].html')).trim()) {
                Report.editReportComment(props.reportID, props.action, trimmedNewDraft);
            }

    See demo

    Screen.Recording.2023-10-11.at.7.00.09.PM.mov

    What alternative solutions did you explore? (Optional)

    We can also add condition

    trimmedNewDraft === parser.htmlToMarkdown(lodashGet(props.action, 'message[0].html')).trim()

    in method Report.editReportComment to skip saving the draft, like here. I prefer the main solution as it avoids unnecessary text processing and is closer to the draft update function.

  12. 28 remaining items

  13. melvin-bot commented on Oct 20, 2023

    @melvin-bot

    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:

    • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
    • [@parasharrajat] 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:
    • [@parasharrajat] 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:
    • [@parasharrajat] Determine if we should create a regression test for this bug.
    • [@parasharrajat] 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.
    • [@zanyrenney] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  14. zanyrenney commented on Oct 27, 2023

    @zanyrenney
    Contributor

    @parasharrajat does not require payment (Eligible for Manual Requests) owed $500
    @eh2077 requires payment offer (Contributor) - paid $500
    @dhanashree-sawant requires payment offer (Reporter) paid $50

    #29225 (comment) merged in 4 days, no bonus

    Paid out, closing!

  15. eh2077 commented on Oct 27, 2023

    @eh2077
    Contributor

    @zanyrenney Thanks for checking the payment!

    I think bonus is applicable because @parasharrajat had reviewed and approved PR within 3 days and the internal engineer late merged the PR without additional review comments in the PR #29418 (review).

  16. parasharrajat commented on Oct 29, 2023

    @parasharrajat
    Member

    Agree With @eh2077

  17. parasharrajat commented on Oct 29, 2023

    @parasharrajat
    Member

    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:

    Regression Test Steps

    1. Go to a chat and add a comment google.com.
    2. Verify google.com is displayed as a link
    3. Edit the message from [google.com](https://google.com/) to google.com and save it
    4. Verify google.com is displayed as plain text
    5. Click to edit the message and save it without making changes
    6. Verify the message is not changed and google.com is still displayed as plain text
    7. Edit the message from google.com to google.com http://new.expensify.com/ and save it
    8. Verify both google.com and http://new.expensify.com/ are displayed as links
    9. Edit the message from [google.com](https://google.com/) [http://new.expensify.com/](http://new.expensify.com/) to [google.com](https://google.com/) http://new.expensify.com/ and save it.
    10. Verify that google.com is displayed as a link and http://new.expensify.com/ is displayed as plain text
    11. Click to edit the message and save it without making changes
    12. Verify that the message has not changed and they're displayed the same as in step 10.

    Do you agree 👍 or 👎 ?

  18. parasharrajat commented on Dec 5, 2023

    @parasharrajat
    Member

    @zanyrenney Could you please review this #29225 (comment)?

  19. parasharrajat commented on Apr 5, 2024

    @parasharrajat
    Member

    Payment requested as per #29225 (comment)

  20. JmillsExpensify commented on Apr 8, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @parasharrajat

  21. JmillsExpensify commented on Apr 8, 2024

    @JmillsExpensify
    Contributor

    Also, I don't believe we have an regression test for this issue so re-opening.

  22. zanyrenney commented on Apr 11, 2024

    @zanyrenney
    Contributor

    Regression test created.

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.DailyKSv2ExternalAdded 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