-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-07-21] [$1000] Web - Heading after quote is not rendering #21846
Comments
Triggered auto assignment to @conorpendergrast ( |
Triggered auto assignment to @lschurr ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Design team member for new feature review - @shawnborton ( |
Proposed solutionPlease re-state the problem that we are trying to solve in this issue.Heading after quote is not rendering What is the root cause of that problem? A new line is added after the quote message which later got deleted using below code formatTextForQuote(regex, textToCheck, replacement) {
if (textToCheck.match(regex)) {
// Remove '>' and trim each line of quote content
let textToFormat = textToCheck.split('\n').map(row => row.substr(4).trim()).join('\n'); <====== trim is happening here
// Remove leading and trailing line breaks
textToFormat = textToFormat.trim();
return replacement(textToFormat);
}
return textToCheck;
} Input string given to
so after parsing the text following output is retuned.
Now heading regex is looking for What changes do you think we should make in order to solve the problem?
{
// We're removing <br /> because when <h1> and <br /> occur together, an extra line is added.
name: 'replaceh1br',
regex: /<\/h1><br\s*[/]?>/gi,
replacement: '</h1>',
}, Output generated for a given inputInput: '> quote\n# heading'
Output: '<blockquote>quote</blockquote><h1>heading</h1>'
Input: `> a\n# da\n> test`
Output: '<blockquote>a</blockquote><h1>da</h1><blockquote>test</blockquote>'
Input: `>This is a *quote* that started on a new line.\n# Heading 1 should be captured\nHere is a >quote that did not\n`
Output '<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote><h1>Heading 1 should be captured</h1>Here is a >quote that did not<br />' Additional inputs tested```text > quote # heading > quote ```
What alternative solutions did you explore? (Optional)
// check if next text chunk is heading tag i.e. starts with # then append new line char \n
if (Str.startsWith(textSplitted[i], "# ") )
{
replacedText = `${replacedText}\n`
} After adding
Code changes required: // check if next text chunk is heading tag `starts with # ` then append new line char \n
if (Str.startsWith(textSplitted[i], "# ") )
{
replacedText = `${replacedText}\n`
} {
// We're removing <br /> because when <br /> occur between <blockquote> and <h1>, causing an extra line is added.
name: 'replaceBlockquoteBr',
regex: /<\/blockquote><br\s*[/]?><h1>/gi,
replacement: '</blockquote><h1>',
} Since |
@kbecciv It actually a bug that went unnoticed. Kindly read through the root cause mentioned in my proposal and you will have an idea why it’s happening. |
ProposalPlease re-state the problem that we are trying to solve in this issue.heading in the new line in "quote" section is not formatted. What is the root cause of that problem?The root cause is that quote rule is applied before heading1 rule. The replace function applies rules to convert the text as HTML.(convert markdown characters to HTML tags) There are several rules.(not all markdown, ex: There is no heading2, heading3 rules, etc) Reason - The reportComment where the new line tag "\n" was changed is from "ReportUtils.buildOptimisticAddCommentReportAction()" function. and it is from ExpensiMark().replace() function like this: this function applies the rules. the order of rules is like this: 'quote' and 'heading1', and it is applied by the order in the for loop. so the new line tag "\n" was replaced with What changes do you think we should make in order to solve the problem?By applying the heading1 style first, we can fix this problem like the shared video. The solution is: 2. And then we update modifyTextForQuote So an additional new line(unexpectedly) is added. Finally, we can say that is a problem between analyzing with the new line tag in modifyTextForQuote function(split with "\n" and join with "\n" again) and Video1(test orignal issue) What alternative solutions did you explore? (Optional)we need to update the heading1 rule, considering |
Test screenshot for #21846 (comment) |
I reproduced on OSX desktop and iOS Chrome too. Given that this is markdown, we can probably assume it's affecting all platforms. |
Job added to Upwork: https://www.upwork.com/jobs/~01e498007bd2f0de5b |
Current assignee @conorpendergrast is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt ( |
I see this previous discussion, but it doesn't look entirely similar as that was for whitespace on a single line (and this is multi-line, where only one is a block quote) |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.40-5 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-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.
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
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:
|
@conorpendergrast @s77rt Please consider following timings for bonus eligibility:
After C++ reviewed & approved, following timeline is waiting for internal reviewer to approve and merge the PR.
Total waiting time (internal & merge): 3 days 20hrs approx. Total time elapsed from issue assigned to second PR merged: |
|
I will check in on is one, and confirm before paying. I'm OoO on Monday and Tuesday, and will be back to this on Wednesday 26th with confirmation |
@cead22, @conorpendergrast, @s77rt, @spcheema Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Not overdue per @conorpendergrast 's update above |
@cead22 and I agree with an exception here as the C and C+ acted with urgency. Everyone has been paid accordingly, and contracts ended. We're all done, thanks! |
Thanks @conorpendergrast @cead22 and @s77rt |
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:
Expected Result:
Heading should be rendered
Actual Result:
Markdown heading syntax is not rendering
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.32-5
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
https://github.com/Expensify/App/assets/93399543/8626f832-2e3e-4705-9f42-59b82d7d7172
https://github.com/Expensify/App/assets/93399543/7f95a2a1-6c96-4a48-afbe-712edae38043
Expensify/Expensify Issue URL:
Issue reported by: @eh2077
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1687921581684809
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: