Skip to content

[HOLD for payment 2023-07-17] [$1000] Chat - A line break is resulted from pasting quote message #20725

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 staging.new.expensify.com
  2. Go to any chat with quote message
  3. Copy the quote message
  4. Paste the quote message in the composer

Expected Result:

There is no extra space or line break from pasting the quote message

Actual Result:

A line break is resulted from pasting the quote 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.27.4

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

Bug6091801_Recording__65.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018cc9d1380c77d6b3
  • Upwork Job ID: 1668901682244857856
  • Last Price Increase: 2023-06-22

Activity

  1. added
    Daily
    Bug
    on Jun 13, 2023
  2. melvin-bot commented on Jun 13, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jun 13, 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
  4. Nikhil-Vats commented on Jun 13, 2023

    @Nikhil-Vats
    Contributor

    Proposal

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

    A line break is resulted from pasting quote message.

    What is the root cause of that problem?

    For pasting HTML, we use expensify-common -

    handlePastedHTML(html) {
    const parser = new ExpensiMark();
    this.paste(parser.htmlToMarkdown(html));
    }

    In expensify-common quote rule for htmlToMarkdown, we add new line at the beginning and end of the return value here -

    https://github.com/Expensify/expensify-common/blob/9dfabe1de4213b0fd60ae3aa6a57012dd6545c72/lib/ExpensiMark.js#L289-L299

    return `\n${resultString}\n`;

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

    Remove \n from beginning and end of return value to make line 299 in expensify-common -

    return resultString;

    What alternative solutions did you explore? (Optional)

    NA

    Result
    Screen.Recording.2023-06-14.at.4.17.21.AM.mov
  5. eh2077 commented on Jun 14, 2023

    @eh2077
    Contributor

    Proposal

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

    A line break is resulted from pasting quote message.

    What is the root cause of that problem?

    Copying a quote comment, like

    > test
    

    save following html

    <meta charset='utf-8'><div><div><comment><blockquote>test</blockquote></comment></div></div>

    to clipboard, see

    Clipboard.setHtml(selection, Str.htmlDecode(parser.htmlToText(selection)));

    Pasting into composer converts the above html to following markdown

    > test
    

    See quote-html-to-markdown rule translates html piece

    <blockquote>test</blockquote>

    to text

    > test
    
    

    And the ending line break is removed in method replaceBlockElementWithNewLine when stripping <div> tags. That's in the composer we get

    > test
    

    Instead of

    > test
    
    

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

    To fix this issue, we can let method replaceBlockElementWithNewLine handle line break for <blockquote> tag, like what we do for <h1> tag, see here.

    To achieve it, we can

    1. Change this line
    return `\n${resultString}\n`;

    to

    // We want to keep <blockquote> tag here and let method replaceBlockElementWithNewLine to handle the line break later
    return `<blockquote>${resultString}</blockquote>`;
    1. Let methohd replaceBlockElementWithNewLine by changing this line
    let splitText = htmlString.split(/<div.*?>|<\/div>|<comment.*?>|\n<\/comment>|<\/comment>|<h1>|<\/h1>|<h2>|<\/h2>|<h3>|<\/h3>|<h4>|<\/h4>|<h5>|<\/h5>|<h6>|<\/h6>|<p>|<\/p>|<li>|<\/li>/);

    to

    let splitText = htmlString.split(/<div.*?>|<\/div>|<comment.*?>|\n<\/comment>|<\/comment>|<h1>|<\/h1>|<h2>|<\/h2>|<h3>|<\/h3>|<h4>|<\/h4>|<h5>|<\/h5>|<h6>|<\/h6>|<p>|<\/p>|<li>|<\/li>|<blockquote>|<\/blockquote>/);

    What alternative solutions did you explore? (Optional)

    N/A

  6. conorpendergrast commented on Jun 14, 2023

    @conorpendergrast

    Weird, I wonder if this is a regression.

    I see this happening and so it's reproducible:

    image

    After sending the message though, it doesn't show the line breaks:

    image
  7. added
    External
    on Jun 14, 2023
  8. changed the title [-]Chat - A line break is resulted from pasting quote message[/-] [+][$1000] Chat - A line break is resulted from pasting quote message[/+] on Jun 14, 2023
  9. melvin-bot commented on Jun 14, 2023

    @melvin-bot
  10. melvin-bot commented on Jun 14, 2023

    @melvin-bot

    Current assignee @conorpendergrast is eligible for the External assigner, not assigning anyone new.

  11. melvin-bot commented on Jun 14, 2023

    @melvin-bot

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

  12. added
    Help Wanted
    on Jun 14, 2023
  13. 83 remaining items

  14. added
    Weekly
    Awaiting Payment
    and removed
    Daily
    on Jul 10, 2023
  15. changed the title [-][$1000] Chat - A line break is resulted from pasting quote message[/-] [+][HOLD for payment 2023-07-17] [$1000] Chat - A line break is resulted from pasting quote message[/+] on Jul 10, 2023
  16. removed
    Reviewing
    on Jul 10, 2023
  17. melvin-bot commented on Jul 10, 2023

    @melvin-bot

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

  18. melvin-bot commented on Jul 10, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.38-7 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-07-17. 🎊

    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.

    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
  19. melvin-bot commented on Jul 10, 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:

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

    @conorpendergrast

    Ah, I withdrew the initial contract and re-sent to @eh2077

  21. added
    Daily
    and removed
    Weekly
    on Jul 17, 2023
  22. conorpendergrast commented on Jul 18, 2023

    @conorpendergrast

    Payment made to @eh2077. Final step is the checklist for @narefyev91 to complete, please! Then we can close this out

  23. narefyev91 commented on Jul 18, 2023

    @narefyev91
    Contributor
    • The PR that introduced the bug has been identified - it was fully new requirements and fixes to make it working during pasting - i can say that those code changes fix any regression from someone - it was fully missed implementation
    • 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 - no comments
    • 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 - no discussions
    • Determine if we should create a regression test for this bug - in case that it's not a regression - we are good to not have any steps here
  24. conorpendergrast commented on Jul 18, 2023

    @conorpendergrast

    Sounds good to me. Closing out as all resolved now, thank you!

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions