-
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
[$250] Chat - After editing nested quote message, the markdown is removed #47951
Comments
Triggered auto assignment to @twisterdotcom ( |
@twisterdotcom FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
We think that this bug might be related to #vip-vsp |
ProposalPlease re-state the problem that we are trying to solve in this issue.After editing a nested quote markdown, the quote markdown is removed. What is the root cause of that problem?When we send A quote markdown requires a space after
This shows that the logic doesn't cover the case of nested quote yet. So, you don't need to edit the message but just sends What changes do you think we should make in order to solve the problem?To allow nested quote have optional space between
This will convert it to markdown for below inputs:
|
Edited by proposal-police: This proposal was edited at 2024-08-30 20:43:57 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Editing quote markdown message does not work as desired What is the root cause of that problem?RCA for the issue is -
What changes do you think we should make in order to solve the problem?So, to tackle this we need to completely redesign
{
name: 'quote',
regex: /<(blockquote|q)(?:"[^"]*"|'[^']*'|[^'">])*>(([\s\S]*?)<\/\1>)+(?![^<]*(<\/pre>|<\/code>))/gi,
replacement: (_extras, _match, _g1,g2) => {
// We remove the line break before heading inside quote to avoid adding extra line
let resultString = _match
.replace(/\n?(<h1># )/g, '$1')
.replace(/(<h1>|<\/h1>)+/g, '\n')
.replace(/(<\/blockquote>)+/g, (match)=> { match + '\n' })
.trim()
.split('\n');
// Wrap each string in the array with <blockquote> and </blockquote>
let depth =0;
resultString = resultString.map((line) => {
let modifiedLine = line;
depth+= modifiedLine.match(/<blockquote>/gi)?.length || 0;
modifiedLine = modifiedLine.replace(/<blockquote>/gi, '');
modifiedLine = modifiedLine.replace(/<\/blockquote>/gi, '');
let resultString = `${'<blockquote>'.repeat(depth)}${modifiedLine}${'</blockquote>'.repeat(depth)}`;
depth-=line.match(/<\/blockquote>/gi)?.length || 0;
return resultString;
});
resultString = resultString
.map((text) => {
let modifiedText = text;
let depth;
do {
depth = (modifiedText.match(/<blockquote>/gi) || []).length;
modifiedText = modifiedText.replace(/<blockquote>/gi, '');
modifiedText = modifiedText.replace(/<\/blockquote>/gi, '');
} while (/<blockquote>/i.test(modifiedText));
return `${'> '.repeat(depth)}${modifiedText}`;
})
.join('\n');
return `<blockquote>${resultString}</blockquote>`;
},
},
if ((textSplitted[i].match(/^( *(> )+)+ /gm) || isLastBlockquote) && !insideCodefence) { What alternative solutions did you explore? (Optional)Changing this rule slightly would provide correct markdown equvalent. return return |
@twisterdotcom Whoops! This issue is 2 days overdue. Let's get this updated quick! |
@twisterdotcom Eep! 4 days overdue now. Issues have feelings too... |
Agree, this one was simple to reproduce. Apologies for the time, I am just back from OOO. |
Job added to Upwork: https://www.upwork.com/jobs/~01a7ea8bf9646df697 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh ( |
updated proposal, added alternative solution which looks more sensible to me |
@twisterdotcom, @fedirjh Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Bump @fedirjh on these proposals |
@bernhardoj's Proposal looks good to me. Let's use the regex as it covers different variations of nested quotes with spaces. 🎀 👀 🎀 C+ reviewed |
Triggered auto assignment to @cead22, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@fedirjh It looks like two blockquotes must be separated by space is recommended design feature. So, we might need a design review on this one. check #45154 (comment) . |
Just a note that if we require space for each |
Hello, today I continued fixing HTML to markdown parsing logic. Tomorrow I will clean up the code and push the changes to the PR so we can start merging it |
@cead22, @twisterdotcom, @fedirjh, @Skalakid Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Hello, I'm adding last touches to my PR with the solution for this issue. Will open it for the review today |
@cead22, @twisterdotcom, @fedirjh, @Skalakid Eep! 4 days overdue now. Issues have feelings too... |
PR is waiting for the C+ review |
@cead22, @twisterdotcom, @fedirjh, @Skalakid Whoops! This issue is 2 days overdue. Let's get this updated quick! |
This was merged, so it is waiting on a deploy now? |
@cead22, @twisterdotcom, @fedirjh, @Skalakid 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
The PR has been merged. We will bump the Expensify-common together with the next Live Markdown bump since some new breaking changes were introduced there |
@cead22, @twisterdotcom, @fedirjh, @Skalakid Still overdue 6 days?! Let's take care of this! |
Waiting for this PR to be merged, since it bumps the Live Markdown and expensify-common libraries |
@cead22, @twisterdotcom, @fedirjh, @Skalakid 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it! |
Would be nice to get an update on this one. Is it likely be getting daily updates, or should we make it weekly for now if we're beholden to some other deployment schedules? |
The solution is ready; we are only waiting to bump the libraries in the app. As I wrote above today, this will be done by this PR. For now, we can make it weekly, but the changes should be merged this week if nothing critical appear |
@Skalakid Do the changes from this PR (Expensify/expensify-common#820) be shipped with that PR #53627 ? |
@fedirjh yes, they bumped the |
This issue has not been updated in over 15 days. @cead22, @twisterdotcom, @fedirjh, @Skalakid eroding to Monthly issue. P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do! |
This seems to be fixed. I think this can be closed. |
Wait, with no payment? |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.24-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4884121
Email or phone of affected tester (no customers): applausetester+vd_web082324@applause.expensifail.com
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
The markdown should still be displayed after editing the message
Actual Result:
The quote markdown effect is removed after editing a nested quote message
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6580735_1724447327796.bandicam_2024-08-23_17-01-00-816.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @fedirjhThe text was updated successfully, but these errors were encountered: