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-03-31] [$4000] Adding the 2 line break in message that is inside the code block with header text is hiding the edited messaged #15302

Closed
1 task
kavimuru opened this issue Feb 20, 2023 · 57 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

@kavimuru
Copy link

kavimuru commented Feb 20, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Go to any chat
  2. Send a code block message with h1 text inside (e.g. # hello)
  3. Edit the above message and add 2 line break in the message
  4. Check the Message and the Observe the result

Expected Result:

Message should not be hidden and it should display edited message

Actual Result:

Message will be hidden after a second

Workaround:

unknown

Platforms:

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

  • iOS / native

Version Number: 1.2.74-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:

Recording.3738.mp4
message-hide-vodeblock.1.mp4
message-hidden.1.mov

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a0e20796efbb701d
  • Upwork Job ID: 1628571831573925888
  • Last Price Increase: 2023-03-09
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 20, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 20, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Feb 20, 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 melvin-bot bot added the Overdue label Feb 22, 2023
@adelekennedy
Copy link

I haven't been able to find a dupe for this one (though my searching might be failing me) and still reproducible

@melvin-bot melvin-bot bot removed the Overdue label Feb 23, 2023
@adelekennedy adelekennedy added the External Added to denote the issue can be worked on by a contributor label Feb 23, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 23, 2023
@melvin-bot melvin-bot bot changed the title Adding the 2 line break in message that is inside the code block with header text is hiding the edited messaged [$1000] Adding the 2 line break in message that is inside the code block with header text is hiding the edited messaged Feb 23, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

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

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

@ntdiary
Copy link
Contributor

ntdiary commented Feb 23, 2023

Proposal

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

```

# test

```

Send a code block message like the above one, then edit the message and add 2 line break before # and save changes. this message will be hidden.

What is the root cause of that problem?

const isDeleted = isDeletedAction(reportAction);

push
When we update with the same content as the original message, the backend will push an empty html data, it means that this message is deleted and will be hidden.

The AddComment data:
add

The UpdateComment data:
update

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

when we save changes , the above condition is false, so the code isn't interrupted, and then backend will push a empty html data to frontend. (parsedOriginalCommentHTML is <pre>#&#32;test<br /><br /></pre>, and htmlForNewComment.trim() is <pre><br />#&#32;test<br /><br /></pre>)

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

When making comparisons, we should have consistent conversion rules.
I'm not sure why the changes in @marktoman 's commit are different from his proposal, maybe I'm missing something?
IMO, his original proposal is fine: (convert <pre> to ```\n)
ExpensiMark.js:

{
    name: 'codeFence',
    regex: /<(pre)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)(\n?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi,
    replacement: (match, g1, g2, g3) => `\`\`\`\n${g2}${g3 || '\n'}\`\`\``,
},

related comment and pr:
#14694 (comment)
https://github.com/Expensify/expensify-common/pull/496/files

What alternative solutions did you explore? (Optional)

I'm not sure if the backend acts for any other purpose, maybe we could push the same content instead of empty data if the comment remains the same?

The problem of pushing empty message may be treated as a separate bug.

@eh2077
Copy link
Contributor

eh2077 commented Feb 23, 2023

Proposal

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

Editing a code block message by adding 2 line break in the message will hide the message after saving.

What is the root cause of that problem?

When deciding to save an edited message, we do markdown-to-html, html-to-markdown and markdown-to-html conversion to check if need to save the edited message. In this case, this branch condition is false while htmlForNewComment is same with the previous backend saved value and then the backend will return empty data resulting in hiding the message from frontend.

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

To fix this issue, we should ensure code fence markdown-to-html conversion is equal to markdown-to-html => html-to-markdown => markdown-to-html conversion. We can improve html-to-markdown conversion rule for code fence from
https://github.com/Expensify/expensify-common/blob/a2942d035614bf4bed90ffe2114d6ee828ee96da/lib/ExpensiMark.js#L274

replacement: (match, g1, g2, g3, g4) => `\`\`\`${g2 || '\n'}${g3}${g4 || '\n'}\`\`\``,

to

replacement: (match, g1, g2, g3, g4) => `\`\`\`${g2 ? '\n\n' : '\n'}${g3}${g4 || '\n'}\`\`\``,

What alternative solutions did you explore? (Optional)

NA

@melvin-bot melvin-bot bot added the Overdue label Feb 27, 2023
@ntdiary
Copy link
Contributor

ntdiary commented Feb 27, 2023

Proposal

Updated

@aimane-chnaif
Copy link
Contributor

I think issue description needs updated a bit. This happens on all text (not only header text) inside code block.

The weird thing in this video is that when refresh Report page (either go to another tab or to switch chat and come back), disappeared message shows again.

bug.mov

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Feb 27, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Adding the 2 line break in message that is inside the code block with header text is hiding the edited messaged [$2000] Adding the 2 line break in message that is inside the code block with header text is hiding the edited messaged Mar 2, 2023
@MelvinBot
Copy link

@deetergp, @adelekennedy, @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@deetergp
Copy link
Contributor

deetergp commented Mar 2, 2023

I have not been able to reproduce the disappearing behavior in either staging, nor production. The number of line breaks I put before the text does not stay consistent, but the code block never ceases to be visible. Can I get a re-test from someone else?

@melvin-bot melvin-bot bot removed the Overdue label Mar 2, 2023
@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Mar 31, 2023
@MelvinBot
Copy link

@deetergp, @adelekennedy, @aimane-chnaif, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@adelekennedy
Copy link

@harshad2711 will you apply for the reporting bonus here?

@melvin-bot melvin-bot bot removed the Overdue label Apr 4, 2023
@aimane-chnaif
Copy link
Contributor

@adelekennedy this is eligible for timeline bonus. PR was merged within 5 days but 2 days were weekend

@adelekennedy
Copy link

adelekennedy commented Apr 4, 2023

@aimane-chnaif shoot - good catch, adding 50% bonus

@harshad2711
Copy link

@harshad2711 will you apply for the reporting bonus here?

Thanks @adelekennedy , I have applied

@melvin-bot melvin-bot bot added the Overdue label Apr 7, 2023
@MelvinBot
Copy link

@deetergp, @adelekennedy, @aimane-chnaif, @situchan Eep! 4 days overdue now. Issues have feelings too...

@MelvinBot
Copy link

@deetergp, @adelekennedy, @aimane-chnaif, @situchan Huh... This is 4 days overdue. Who can take care of this?

@deetergp
Copy link
Contributor

Still on hold

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 10, 2023
@adelekennedy
Copy link

still on hold

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 13, 2023
@MelvinBot
Copy link

@deetergp, @adelekennedy, @aimane-chnaif, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

@adelekennedy
Copy link

what are we holding here for? All payments have been made but do we need to take any other steps? @deetergp @aimane-chnaif

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 18, 2023
@aimane-chnaif
Copy link
Contributor

Not able to find exact PR which caused regression. I think this issue existed from the beginning when we add codeFence html-> markdown regex, just not found that case. We kind of ignored line break issue before but now it became priority because it causes critical bug of message removed when edit with special case.
Based on this, I think first 3 items can be checked off.

For regression test steps, I think new automated test cases added in expensify-common PR should be enough.

@melvin-bot melvin-bot bot removed the Overdue label Apr 23, 2023
@deetergp
Copy link
Contributor

Sounds good, @aimane-chnaif, I agree with your assessment an checked off everything on the list. Let's close this one out 👍

@harshad2711
Copy link

@adelekennedy Sorry to bother you, but please confirm if you have approved my payment, as the milestone is showing In the review to me

@adelekennedy
Copy link

@harshad2711 ended the contract and added a bonus for the delay

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

10 participants