Skip to content
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-10-18] [HOLD for payment 2023-10-16] [$500] Inconsistent behavior when editing links with the same links in private notes with chat #28545

Closed
6 tasks done
kbecciv opened this issue Sep 30, 2023 · 39 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Sep 30, 2023

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. Start a chat and write any links.
  2. Edit the links with the same links and observe that the links change to text.
  3. Click on the header to open the private note.
  4. Write a link in the note.
  5. Go back to the previous screen and edit the link in the note with the same link.
  6. Observe that the link remains as a link instead of changing to text, creating an inconsistency between chat and private note

Expected Result:

When editing links with the same links in private notes, they should change to text to maintain consistency with the chat.

Actual Result:

When editing links with the same links in private notes, they do not change to text, creating inconsistency with the message.

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

Screen.Recording.2023-09-30.at.10.54.43.AM.mov
Screen.Recording.2023-09-29.at.10.49.36.PM.mov
Recorder_30092023_191019.mp4
Recorder_30092023_090249.mp4
screen-capture.2.mp4
Recording.4754.mp4

Expensify/Expensify Issue URL:
Issue reported by: @tewodrosGirmaA
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695444384364589

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0160ac2aef66f8c337
  • Upwork Job ID: 1708186833336647680
  • Last Price Increase: 2023-09-30
  • Automatic offers:
    • s77rt | Reviewer | 27022487
    • abzokhattab | Contributor | 27022489
    • tewodrosGirmaA | Reporter | 27022491
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 30, 2023
@melvin-bot melvin-bot bot changed the title Inconsistent behavior when editing links with the same links in private notes with chat [$500] Inconsistent behavior when editing links with the same links in private notes with chat Sep 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0160ac2aef66f8c337

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

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

@abzokhattab
Copy link
Contributor

abzokhattab commented Sep 30, 2023

Proposal

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

We don't handle the case where the user want to show links as raw text not a hyperlink in the private notes page

What is the root cause of that problem?

we always convert the input to an html format and dont consider the case where the user removes links from the old value on purpose

const editedNote = parser.replace(privateNote.trim());

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

instead of converting the input as a html right away, we should consider the original value and handle deleted links in html like we are doing in the chat handling:

        const originalNote = lodashGet(report, ['privateNotes', route.params.accountID, 'note'], '');
        const editedNote = Report.handleUserDeletedLinksInHtml(privateNote.trim(), originalNote);

POC:

Screen.Recording.2023-09-30.at.9.53.46.PM.mov

@saranshbalyan-1234
Copy link
Contributor

saranshbalyan-1234 commented Sep 30, 2023

Proposal

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

While editing the comment, we are not able to get the link again

What is the root cause of that problem?

The error is during parsing of comment while editing.

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

App/src/libs/actions/Report.js

Lines 1154 to 1165 in 52f0e3c

const handleUserDeletedLinksInHtml = (newCommentText, originalHtml) => {
const parser = new ExpensiMark();
if (newCommentText.length > CONST.MAX_MARKUP_LENGTH) {
return newCommentText;
}
const markdownOriginalComment = parser.htmlToMarkdown(originalHtml).trim();
const htmlForNewComment = parser.replace(newCommentText);
const removedLinks = parser.getRemovedMarkdownLinks(markdownOriginalComment, newCommentText);
return removeLinksFromHtml(htmlForNewComment, removedLinks);
};
/**

The issue is with the argument we are passing in getRemovedMarkdownLinks
We are passing markdownOriginalComment(Markdown) and newCommentText(Text)

What alternative solutions did you explore? (Optional)

We can just convert the the new comment to markdown as well
like this

const handleUserDeletedLinksInHtml = (newCommentText, originalHtml) => {
    const parser = new ExpensiMark();
    if (newCommentText.length > CONST.MAX_MARKUP_LENGTH) {
        return newCommentText;
    }
    const markdownOriginalComment = parser.htmlToMarkdown(originalHtml).trim();
    const htmlForNewComment = parser.replace(newCommentText);
    const markdownNewComment = parser.htmlToMarkdown(htmlForNewComment).trim();
    const removedLinks = parser.getRemovedMarkdownLinks(markdownOriginalComment, markdownNewComment);
    return removeLinksFromHtml(htmlForNewComment, removedLinks);
};

What alternative solutions did you explore? (Optional)

N/A

@saranshbalyan-1234
Copy link
Contributor

updated proposal #28545 (comment)

@saranshbalyan-1234
Copy link
Contributor

Result for #28545 (comment)

screen-recording-2023-09-30-at-121449-pm_IMqB0XVr.mp4

@chahedmoetaz
Copy link

Hello sir
I check this error and im able to fix it
Contact me for more details
Available to start immediately
And it will takes 3 days for build and test it carfully

@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

📣 @chahedmoetaz! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Sep 30, 2023

Proposal

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

Editing comments and private notes have different behaviors when entering the same links

What is the root cause of that problem?

In the code, the text is formatted differently

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

To fix this bug
we can reproduce the same text formatting as for editing comments

First:
We can delete parser.replace for note

const editedNote = parser.replace(privateNote.trim());

like here for comment

const trimmedNewDraft = draft.trim();

Second:

Instead reportID we will pas report

Report.updatePrivateNotes(report.reportID, route.params.accountID, editedNote);

Third:

We can add a formatter for note

const updatePrivateNotes = (report, accountID, newNote) => {
				const originalNote = lodashGet(report, ['privateNotes', accountID, 'note'], '');
				const note = handleUserDeletedLinksInHtml(newNote, originalNote);

like here for a comment

App/src/libs/actions/Report.js

Lines 1179 to 1180 in 7c86d09

const originalCommentHTML = lodashGet(originalReportAction, 'message[0].html');
const htmlForNewComment = handleUserDeletedLinksInHtml(textForNewComment, originalCommentHTML);

What alternative solutions did you explore? (Optional)

NA

@s77rt
Copy link
Contributor

s77rt commented Oct 1, 2023

@abzokhattab Thanks for the proposal. Your RCA makes sense and the solution looks good to me.

🎀 👀 🎀 C+ reviewed
Link to proposal

@melvin-bot
Copy link

melvin-bot bot commented Oct 1, 2023

Triggered auto assignment to @johnmlee101, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@s77rt
Copy link
Contributor

s77rt commented Oct 1, 2023

@saranshbalyan-1234 Thanks for the proposal. The RCA is not clear. Regardless we want to the notes to behave like report messages and not the other way around.

@s77rt
Copy link
Contributor

s77rt commented Oct 1, 2023

@ZhenjaHorbach Thanks for the proposal but I think it's a dupe.

@saranshbalyan-1234
Copy link
Contributor

@s77rt the reason why i posted my proposal in the reverse way is because it seems good. Links should be treated as links not text. Kindly take another look at the behaviour.

@s77rt
Copy link
Contributor

s77rt commented Oct 1, 2023

@saranshbalyan-1234 The behaviour of the report messages is intended and we have tests to ensure that.

// User deletes www.google.com link from comment but keeps link text
// We should not generate link
originalCommentHTML = 'Comment <a href="https://www.google.com" target="_blank">www.google.com</a>';
afterEditCommentText = 'Comment www.google.com';
newCommentHTML = Report.handleUserDeletedLinksInHtml(afterEditCommentText, originalCommentHTML);
expectedOutput = 'Comment www.google.com';
expect(newCommentHTML).toBe(expectedOutput);

@saranshbalyan-1234
Copy link
Contributor

@s77rt ohhh i see, thanks

@melvin-bot melvin-bot bot added the Overdue label Oct 4, 2023
@johnmlee101
Copy link
Contributor

Any updates?

@melvin-bot melvin-bot bot removed the Overdue label Oct 4, 2023
@s77rt
Copy link
Contributor

s77rt commented Oct 4, 2023

@johnmlee101 This is waiting for you 😅 #28545 (comment)

@s77rt
Copy link
Contributor

s77rt commented Oct 5, 2023

@chahedmoetaz This is fixed already

@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

🎯 ⚡️ Woah @s77rt / @abzokhattab, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @abzokhattab got assigned: 2023-10-04 16:53:49 Z
  • when the PR got merged: 2023-10-06 15:01:42 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 9, 2023
@melvin-bot melvin-bot bot changed the title [$500] Inconsistent behavior when editing links with the same links in private notes with chat [HOLD for payment 2023-10-16] [$500] Inconsistent behavior when editing links with the same links in private notes with chat Oct 9, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.79-5 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-10-16. 🎊

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:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

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:

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

@s77rt
Copy link
Contributor

s77rt commented Oct 11, 2023

  • The PR that introduced the bug has been identified: This existed since day one and it's more like a feature request than a bug
  • The offending PR has been commented on: Not applicable
  • A discussion in #expensify-bugs has been started: Not needed
  • Determine if we should create a regression test for this bug: No

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 11, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-16] [$500] Inconsistent behavior when editing links with the same links in private notes with chat [HOLD for payment 2023-10-18] [HOLD for payment 2023-10-16] [$500] Inconsistent behavior when editing links with the same links in private notes with chat Oct 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.80-3 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-10-18. 🎊

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:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

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:

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

@s77rt
Copy link
Contributor

s77rt commented Oct 11, 2023

This #28545 (comment) is irrelevant. That PR linked to this issue by mistake.

The checklist for this issue is provided here #28545 (comment)

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 Daily KSv2 labels Oct 16, 2023
@NicMendonca
Copy link
Contributor

NicMendonca commented Oct 18, 2023

BZ payment Summary:

Reporter: @tewodrosGirmaA (paid via Upwork) - $50
Contributor: @abzokhattab (paid via Upwork) - $750
C+: @s77rt (paid via Upwork) - $750

@melvin-bot melvin-bot bot removed the Overdue label Oct 18, 2023
@NicMendonca
Copy link
Contributor

everyone has been paid 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants