Skip to content

[$500] Private Note - Link changed to text in the Private Note after saved 2nd time. #30076

Closed

Description

@kbecciv

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.87.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: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697045812115269

Action Performed:

  1. Open a chat with other user
  2. Click header => Private notes
  3. Click My note => Note
  4. Input any link (eg: google.com) => Save
  5. Click Note, remove all and input link again (eg: google.com) => Save
  6. Click Note => Save, Observed that text back to link

Expected Result:

Link should not change to text in the Private Note after saved 2nd time.

Actual Result:

Link changed to text in the Private Note after saved 2nd time.

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
Screen.Recording.2023-10-12.at.00.46.33.mov
Android: mWeb Chrome
Screen.Recording.2023-10-12.at.00.47.14.mov
iOS: Native
RPReplay_Final1697046524.MP4
iOS: mWeb Safari
RPReplay_Final1697046558.MP4
MacOS: Chrome / Safari
Screen.Recording.2023-10-12.at.00.46.03.mov
Recording.5076.mp4
MacOS: Desktop

Uploading Screen Recording 2023-10-12 at 00.46.03.mov…

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01845ea2c6e56f7e38
  • Upwork Job ID: 1715351205310087168
  • Last Price Increase: 2023-10-20
  • Automatic offers:
    • fedirjh | Reviewer | 27439928
    • eh2077 | Contributor | 27439932
    • namhihi237 | Reporter | 27439936

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 20, 2023
  2. changed the title [-]Private Note - Link changed to text in the Private Note after saved 2nd time.[/-] [+][$500] Private Note - Link changed to text in the Private Note after saved 2nd time.[/+] on Oct 20, 2023
  3. melvin-bot commented on Oct 20, 2023

    @melvin-bot

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

  4. melvin-bot commented on Oct 20, 2023

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

    @melvin-bot

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

  8. abdel-h66 commented on Oct 20, 2023

    @abdel-h66
    Contributor

    Proposal

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

    Editing and saving a private note that contains a link without making a change, re-creates the link.

    What is the root cause of that problem?

    Adding a private note that contains a link will create the AutoLink on save. And when a link is removed, we will check for removed links and generate the new HTML. For the case of editing and saving a private note that contains a link without making a change, we are not supposed to generate a new HTML, as this process will trigger the Auto link again.

    const editedNote = Report.handleUserDeletedLinksInHtml(privateNote.trim(), originalNote);

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

    Since saving a private note that contains a link with a new change is considered an expected behavior per #29225 (comment) we can make sure that saving a note without making a change does not trigger the autolink by comparing the original note and new draft and checking differences and then in that case we return early.

        const savePrivateNote = () => {
            const originalNote = lodashGet(report, ['privateNotes', route.params.accountID, 'note'], '');
    
            const trimmedPrivateNote = privateNote.trim();
    
            if(originalNote === trimmedPrivateNote) {
                dismissKeyboardAndGoBack()
                return;
            }
    
            const editedNote = Report.handleUserDeletedLinksInHtml(trimmedPrivateNote, originalNote);
            Report.updatePrivateNotes(report.reportID, route.params.accountID, editedNote);
            dismissKeyboardAndGoBack()
        };

    What alternative solutions did you explore? (Optional)

    N/A

  9. samilabud commented on Oct 20, 2023

    @samilabud
    Contributor

    How you can send a proposal at the same time the issue is published? OMG 💨

  10. brunovjk commented on Oct 20, 2023

    @brunovjk
    Contributor

    In the main branch we have:

    const editedNote = Report.handleUserDeletedLinksInHtml(privateNote.trim(), parser.htmlToMarkdown(originalNote).trim());

    However, in another branch, like this one, we have:

    const editedNote = Report.handleUserDeletedLinksInHtml(privateNote.trim(), originalNote);

    I managed to reproduce the error using main const editedNote, but when I removed parser.htmlToMarkdown(...).trim(), like the branch presented previously, the error in this issue is no longer reproduced.

    @kbecciv, @namhihi237 and @abdel-h66 Do you know why this is? I'm new here, thank you.

  11. brunovjk commented on Oct 20, 2023

    @brunovjk
    Contributor

    @abdel-h66 I don't know why but dismissKeyboardAndGoBack doesn't seem to work here:
    Reproduction: notback.webm

    I changed your solution a bit, and here on my local it works fine:

        const savePrivateNote = () => {
            const originalNote = lodashGet(report, ['privateNotes', route.params.accountID, 'note'], '');
            const trimmedPrivateNote = privateNote.trim();
    
            if(originalNote != trimmedPrivateNote) {
                const editedNote = Report.handleUserDeletedLinksInHtml(trimmedPrivateNote, originalNote);
                Report.updatePrivateNotes(report.reportID, route.params.accountID, editedNote);
            }
    
            Keyboard.dismiss();
    
            // Take user back to the PrivateNotesView page
            Navigation.goBack(ROUTES.PRIVATE_NOTES_VIEW.getRoute(report.reportID, route.params.accountID));
        };
    
    worked.webm

    @abdel-h66 Make sense?

  12. 20 remaining items

  13. melvin-bot commented on Oct 30, 2023

    @melvin-bot

    📣 @eh2077 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

    Offer link
    Upwork job
    Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
    Keep in mind: Code of Conduct | Contributing 📖

  14. melvin-bot commented on Oct 30, 2023

    @melvin-bot

    📣 @namhihi237 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

    Offer link
    Upwork job

  15. added
    ReviewingHas a PR in review
    and removed on Nov 1, 2023
  16. eh2077 commented on Nov 1, 2023

    @eh2077
    Contributor

    @fedirjh PR #30688 is ready for review, thanks!

  17. Li357 commented on Nov 21, 2023

    @Li357
    Contributor

    @fedirjh @eh2077 Are we good to close this one out?

  18. reopened this on Nov 21, 2023
  19. fedirjh commented on Nov 21, 2023

    @fedirjh
    Contributor

    @Li357 It still requires payments and BZ checklist, it seems like automation didn't work for this one.

  20. fedirjh commented on Nov 21, 2023

    @fedirjh
    Contributor

    BugZero Checklist:


    Regression Test Proposal

    1. Open a chat with another user
    2. Click header -> Private notes -> My note -> Note
    3. Input link, google.com, and save it
    4. Verify google.com is displayed as hyperlink
    5. Click to edit the note
    6. Verify that the initial draft of note is link markdown, [google.com](https://google.com)
    7. Edit and replace the markdown with google.com and save it
    8. Verify that google.com is displayed as plain text
    9. Click to edit the note again
    10. Verify that the initial draft of note is a text: google.com
    11. Save it without making changes
    12. Verify that google.com is still displayed as text
    • Do we agree 👍 or 👎
  21. abekkala commented on Nov 22, 2023

    @abekkala
    Contributor

    PAYMENTS:

  22. abekkala commented on Nov 22, 2023

    @abekkala
    Contributor

    @namhihi237 - @eh2077 - @fedirjh : Payments sent and contracts ended - thank you! 🎉

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions