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-08-21] [$1000] Multiline codeblocks disappear after editing twice #18928

Closed
1 of 6 tasks
kavimuru opened this issue May 14, 2023 · 87 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff

Comments

@kavimuru
Copy link

kavimuru commented May 14, 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. Open the app
  2. Open any report
  3. Send 3 backtick mutline code block
  4. Edit the code block to remove space before last and first characters
  5. Repeat step 4 again

Expected Result:

Codeblock should not disappear on edit

Actual Result:

Codeblock disappears on edit in mac chrome/mac safari

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

2023-05-13.08-54-46.mp4
Recording.616.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1683890048581339

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bba6b459f7297429
  • Upwork Job ID: 1664260132903624704
  • Last Price Increase: 2023-06-08
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 14, 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

@laurenreidexpensify
Copy link
Contributor

2023-05-15_10-36-37 (1)

I can't reproduce this on staging on web

@laurenreidexpensify
Copy link
Contributor

Closing as not reproducible

@dhanashree-sawant
Copy link

Hi @laurenreidexpensify, the issue is when we edit the codeblock again.

@dhanashree-sawant
Copy link

Not able to login on web staging but made a video using mobile chrome, was able to reacreate in first edit if kept the first character and last character or word besides the 3 backticks. The video is over 10 mb so will post it on slack in the report thread

@laurenreidexpensify
Copy link
Contributor

Reopening to review and see if still reproducible as per feedback from @dhanashree-sawant

@melvin-bot melvin-bot bot added the Overdue label Jun 1, 2023
@laurenreidexpensify laurenreidexpensify added the External Added to denote the issue can be worked on by a contributor label Jun 1, 2023
@melvin-bot melvin-bot bot changed the title Multiline codeblocks disappear after editing couple times [$1000] Multiline codeblocks disappear after editing couple times Jun 1, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 1, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01bba6b459f7297429

@melvin-bot
Copy link

melvin-bot bot commented Jun 1, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 1, 2023

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

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

Managed to reproduce, sending to upwork

@melvin-bot
Copy link

melvin-bot bot commented Jun 1, 2023

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

@melvin-bot melvin-bot bot removed the Overdue label Jun 1, 2023
@laurenreidexpensify laurenreidexpensify changed the title [$1000] Multiline codeblocks disappear after editing couple times [$1000] Multiline codeblocks disappear after editing twice Jun 1, 2023
@eh2077
Copy link
Contributor

eh2077 commented Jun 1, 2023

Proposal

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

Multiline codeblocks disappear after editing twice.

What is the root cause of that problem?

Adding a comment

```
1
2```

is translated into html

<pre>1<br />2</pre>

The html above is translated into markdown

```
1
2
```

when click edit the comment.

If edit the comment into

```
1
2```

then in method editReportComment

  1. originalCommentHTML is equal to
<pre>1<br />2</pre>
  1. htmlForNewComment.trim() is
<pre>1<br />2</pre>
  1. But parsedOriginalCommentHTML is equal to
<pre>1<br />2<br /></pre>

after doing html-to-markdown and markdown-to-html conversion, see

parsedOriginalCommentHTML = parser.replace(parser.htmlToMarkdown(originalCommentHTML).trim(), autolinkFilter);

So, the condition

if (parsedOriginalCommentHTML === htmlForNewComment.trim()) {

return false and we save the same html to the backend. Note that the backend will return empty message which make the comment disappear

image

So the root cause is that parsedOriginalCommentHTML is not equal to originalCommentHTML when editing codeblock by removing the last newline.

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

We can add an alternative condition to skip saving the html to backend, like

    if (parsedOriginalCommentHTML === htmlForNewComment.trim() || originalCommentHTML === htmlForNewComment.trim()) {
        return;
    }

What alternative solutions did you explore? (Optional)

N/A

@blockchainGuru1018
Copy link

blockchainGuru1018 commented Jun 2, 2023

Contributor details
Your Expensify account email: fullstack.dev96@hotmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~013d1129fcbf1fe8eb

Proposal

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

Multiline codeblocks disappear after editing twice.

What is the root cause of that problem?

Regarding the add a comment

When you edit the comment like the bellow

```
1
2```

originalCommentHTML and htmlForNewComment.trim() are equal to

<pre>1<br />2</pre>

But parsedOriginalCommentHTML is

<pre>1<br />2<br /></pre>

As a result, this condition returning false value

if (parsedOriginalCommentHTML === htmlForNewComment.trim()) {

That's why the backend will return empty value for the text in their response.

image

But when we switch to other tabs and back to this tab, it corrects with OpenReport query
image

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

Remove outdated code snippet about the conversions of parsedOriginalCommentHTML

if (textForNewComment.length < CONST.MAX_MARKUP_LENGTH) {
const autolinkFilter = {filterRules: _.filter(_.pluck(parser.rules, 'name'), (name) => name !== 'autolink')};
parsedOriginalCommentHTML = parser.replace(parser.htmlToMarkdown(originalCommentHTML).trim(), autolinkFilter);
}

Then we won't save the same html to the backend.

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

📣 @blockchainGuru1018! 📣
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. 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.
  2. 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.
  3. 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>

@melvin-bot
Copy link

melvin-bot bot commented Jun 4, 2023

@puneetlath @laurenreidexpensify @Santhosh-Sellavel this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Jun 4, 2023
@puneetlath
Copy link
Contributor

Cool, sounds good to me. @eh2077 let's make sure we add some automated tests for the various scenarios related to this.

@Skalakid
Copy link
Contributor

Skalakid commented Aug 4, 2023

@abdulrahuman5196 thank you for the review. I created my proposal but before proposing it I wanted to make sure that my solution isn't redundant. Our solutions with @eh2077 are really similar so I decided to propose these changes to @eh2077's idea. So yes, it was cooperation :D

@eh2077
Copy link
Contributor

eh2077 commented Aug 7, 2023

@abdulrahuman5196 I updated the solution to proposal.

I also found the bug is a slight different from the bug report now. The edited comment doesn’t disappear but it'll return to unchanged after switching tab.
See below video

18928-dup.mov

The difference is that the backend now returns empty onyxData data.
image

So the (edited) will show briefly as set edited = true here

isEdited: true,

I think our solution is still applicable to fix the bug.

@puneetlath
Copy link
Contributor

Yes, I fixed the back-end response so that it wouldn't disappear. But I agree, we can still fix the front-end so that it isn't considered to be "edited" and the API doesn't even get called in this scenario.

@eh2077
Copy link
Contributor

eh2077 commented Aug 8, 2023

Gentle bump @abdulrahuman5196. The PR #24205 is ready for review, thanks!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 14, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Multiline codeblocks disappear after editing twice [HOLD for payment 2023-08-21] [$1000] Multiline codeblocks disappear after editing twice Aug 14, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 14, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.53-2 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-08-21. 🎊

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 Aug 14, 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:

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

@laurenreidexpensify
Copy link
Contributor

laurenreidexpensify commented Aug 18, 2023

Payment Summary:

  • External issue reporter - @dhanashree-sawant - $250 offer accepted in Upwork
  • Contributor that fixed the issue - @eh2077 - $1000 offer accepted in Upwork
  • Contributor+ that helped on the issue and/or PR - @abdulrahuman5196 - $1000 offer accepted in Upwork

@eh2077
Copy link
Contributor

eh2077 commented Aug 18, 2023

@laurenreidexpensify Can you kindly send me the offer in Upwork?

@dhanashree-sawant
Copy link

Hi @laurenreidexpensify, I think offer sending for this job is left, I too don't have any offer. Can you check once?

@laurenreidexpensify
Copy link
Contributor

Folks - massive apologies, I don't know why I thought this had been accepted by everyone last week!! I have sent offers to everyone in Upwork now for job https://www.upwork.com/en-gb/jobs/~0189f147050f87dc01, as the original job here expired. Thanks

@eh2077
Copy link
Contributor

eh2077 commented Aug 22, 2023

@laurenreidexpensify Accepted the offer, thank you!

@laurenreidexpensify
Copy link
Contributor

Everyone has been paid in Upwork - @abdulrahuman5196 can you please complete the checklist, thanks

@abdulrahuman5196
Copy link
Contributor

The PR that introduced the bug has been identified. Link to the PR:
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:
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:

Not a regression. Seems to be present for sometime.

Determine if we should create a regression test for this bug.
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.

No. Minor edge. Regression test won't be required.

@laurenreidexpensify

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 Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

10 participants