-
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 #44262] [$250] Chat-Quote Markdown without space is applied as a quote in sent chat but not in compose box #43323
Comments
Triggered auto assignment to @trjExpensify ( |
@trjExpensify 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 this bug might be related to #vip-vsb |
##Proposal Please re-state the problem that we are trying to solve in this issue.Chat-Quote Markdown without space is applied as a quote in sent chat but not in the compose box. What is the root cause of that problem?When typing in the composer, the text is saved to the database (Onyx) with the
The issue lies in the
However, it is being transformed to The function responsible for this transformation in The text input contains > which is captured by this regex: When the regex matches, the text is split into The issue occurs in this condition: This condition determines whether to process the line with What changes do you think we should make in order to solve the problem?To resolve the issue, we need to add another condition to this line:
We also need to check if the We should maintain examples like The following adjustment can be made: // Check for the last occurrence of consecutive > and get the character after it
const match = textSplitted[i].match(/(>)+/);
let charAfterLastGt = '';
let nothingAfterGt = false
if (match) {
const lastIndex = match.index + match[0].length;
charAfterLastGt = textSplitted[i].charAt(lastIndex); // The character after the last consecutive >
nothingAfterGt = lastIndex >= textSplitted[i].length;
}
// We only want to modify lines starting with > that is not codefence
// also if the chart after the last `>` is a space or there's nothing after the `>`
if (Str.startsWith(textSplitted[i], '>') && !insideCodefence && (charAfterLastGt === ' ' || nothingAfterGt)) {
textToFormat += `${textSplitted[i]}\n`;
} else { Tested on 43323-1.mp4What alternative solutions did you explore? |
Can repro, moving |
Job added to Upwork: https://www.upwork.com/jobs/~01352a9a30d580bacb |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
@devguest07 Thanks for your proposal.
I understand that we need to consider hierarchal quotes but won't it causes inconsistency when the character is not an alphabet. For example |
@sobitneupane Sure, I can adjust the The idea is, after the Additionally, we can add examples like |
@devguest07 Can you please update your proposal to reflect the changes required? |
@sobitneupane proposal updated I reversed the logic, instead of seeking if there's some letter after the I added a test to test('Test markdown quotes without spaces with a second line with a space', () => {
const testString = '>test\n> test';
const resultString = '>test<br /><blockquote>test</blockquote>';
expect(parser.replace(testString)).toBe(resultString);
}); and it's passed successfully. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Inconsistency of display for same comment in composer box and chat history. Specifically:
What is the root cause of that problem?Regex
And condition Which is not identical for same comment text in composer box. In composer box, What changes do you think we should make in order to solve the problem?We can either let composer box recognize To achieve former behavior, we should change regex from: const regex = /^(?:>)+ +(?! )(?![^<]*(?:<\/pre>|<\/code>))([^\v\n\r]+)/gm; to const regex = /^(?:>)+ *(?! )(?![^<]*(?:<\/pre>|<\/code>))([^\v\n\r]+)/gm; , from matching '1 or more' spaces to matching '0 or more' spaces. Similar change should be applied to this regex too. To achieve later behavior, we should change '> ' , matching one space after What alternative solutions did you explore? (Optional)N/A |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@trjExpensify Let's hold this issue as it will probably be covered by #42082 |
Probably the same as I mentioned here. I'll let you know if it's not |
Put it on hold! |
Ok, unlike the second issue it's unrelated, but it looks like a regex swap, so I can switch it in that PR I've mentioned |
Great! Let's link that PR to this issue as well then. :) |
@trjExpensify, @sobitneupane Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
I think we might be good here? |
@BrtqKr confirming this issue can be closed? |
@trjExpensify it still has to be enabled in the expensify/app, but after this thing yes |
Okay great, I'm going to update the issue number we're held on. |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
This issue has not been updated in over 15 days. @trjExpensify, @sobitneupane 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! |
Deployed to prod three days ago: #44262 (comment) So we can close this. |
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: 1.4.80-14
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
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:
Action Performed:
Expected Result:
The first line shouldn't be rendered as a quote markdown. It should be rendered as '>hey'
Actual Result:
The first line without space is rendered as a quote.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Bug6505597_1717793936542.2024-06-07_23_11_32.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @sobitneupaneThe text was updated successfully, but these errors were encountered: