-
Notifications
You must be signed in to change notification settings - Fork 3k
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-05-25] [$1000] Chat - Comment disappears when edited in _* text _* format #17785
Comments
Triggered auto assignment to @NicMendonca ( |
Bug0 Triage Checklist (Main S/O)
|
@kbecciv just a heads up, when I refresh, the comment comes back -- does that happen for you as well? Or deletes permanently? |
bump @kbecciv |
@NicMendonca Let me double check with current build, will update you shortly. |
@NicMendonca Confirmed, the comment comes back after refresh. Recording.2574.mp4 |
Okay got it! Super weird. |
Job added to Upwork: https://www.upwork.com/jobs/~01fbc70abb602fff25 |
Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak ( |
Triggered auto assignment to @deetergp ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Comment disappears when edited in _* text _*. What is the root cause of that problem?To dig the root cause, let's start with adding the following comment
It's translated into html <em><strong>test</em></strong> from frontend through method call buildOptimisticAddCommentReportAction => getParsedComment => ExpensiMark.replace. In method ExpensiMark.replace, the italic rule translates the markdown to <em>*test</em>* and then the bold rule translate the above intermediate html to <em><strong>test</em></strong> We find the tag <em><strong>test</strong></em> See this SO discussion about overlapping tags. So when editing the comment, the html corrected by the backend is translated to _*test*_ If we change the markdown to
and save it again. The frontend will again translate it into the overlapping html <em><strong>test</em></strong> through method call editReportComment => handleUserDeletedLinksInHtml => ExpensiMark.replace. And as the overlapping html is different from the original html corrected by the backend, so the overlapping html is saved to backend again. But after the backend corrects the overlapping html and compares with original html, it figures out that frontend sends the same html to save. So the backend returns empty text to frontend and the comment disappears on frontend. So the root cause is that the italic rule and bold rule creates overlapping tags. What changes do you think we should make in order to solve the problem?To fix this issue, I think we can have a method to validate if the text of an element tag includes non-paired tags. For example, if the text g1 of We can have a method containsNonPairTag, like /**
* Check if the input text includes only the open or the close tag of an element.
*
* @param {String} textToCheck - Text to check
*
* @returns {Boolean}
*/
containsNonPairTag(textToCheck) {
const matchedTagPairs = textToCheck.match(/<(.*)\b[^>]*>[^<>]*<\/\1>/gm) || [];
const matchedTags = textToCheck.match(/<[^>]*>/gm) || [];
if (matchedTagPairs.length * 2 !== matchedTags.length) {
return true;
}
return false;
} and use it to by change condition from replacement: (match, g1) => (g1.includes('<pre>') ? match : `<strong>${g1}</strong>`), to replacement: (match, g1) => (g1.includes('<pre>') || this.containsNonPairTag(g1) ? match : `<strong>${g1}</strong>`), We can apply similar fix for What alternative solutions did you explore? (Optional)We can also fix the overlapping HTML from frontend in the same way as the backend does. |
Reviewing the proposals today |
Triggered auto assignment to @zanyrenney ( |
This comment was marked as off-topic.
This comment was marked as off-topic.
Did you not hire any of the people to the upwork issue @NicMendonca ? I can't see anyone hired. |
offers sent @eVoloshchak @eh2077 |
@zanyrenney Accepted. Thank you! |
Going OOO and this is pretty active so needs management by bug0 team member, as per the new process to stay assigned but assign another team member, please can you keep a watch of this. I am OOO until 8th June. Thanks! |
Triggered auto assignment to @Christinadobrzyn ( |
This comment was marked as off-topic.
This comment was marked as off-topic.
Catching up here, @eVoloshchak is C+ - hired in Upwork Upwork job - https://www.upwork.com/jobs/~01fbc70abb602fff25 Does the speed bonus apply to this? I can't find the original PR for this fix @deetergp @eVoloshchak @eh2077 Also, do we need a regression test for this? |
@Christinadobrzyn the original PR is here. Not sure if the bonus applies or not. |
|
Have we bumped the package's version in App yet? |
@luacmartins, Short answer: yes. The long answer is hidden in the back-scroll. |
All I need is the short answer :) Thanks! |
Regression Test Proposal
Do we agree 👍 or 👎 |
Regression test here - https://github.com/Expensify/Expensify/issues/287343 I think this GH is ready to close? @deetergp @luacmartins |
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:
*text*
_*text*_
_*text_*
Expected Result:
Comment NOT disappears
Actual Result:
Comment disappears
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.3.1
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
Bug6026844_Recording__4237.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: