-
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
[$1000] Chat - App removes strikethrough formatting on copy and resend for code block #23034
Comments
ProposalPlease re-state the problem that we are trying to solve in this issue.App removes strikethrough formatting on copy and resend for code block. What is the root cause of that problem?The root cause of this issue is that we translate
to HTML <del><pre>test</pre></del> through strikethrough rule and the HTML is converted back to Markdown ~```
Hello
```
~ through htmlToMarkdownRules. What changes do you think we should make in order to solve the problem?To fix this issue, we can skip applying strikethrough rule if it contains replacement: (match, g1) => (g1.includes('<pre>') || this.containsNonPairTag(g1) ? match : `<del>${g1}</del>`), By doing so, we won't apply strikethrough style for markdown input, like
So, copying and pasting comment will have consistent style, just like italic and bold syntax do. What alternative solutions did you explore? (Optional)N/A |
Triggered auto assignment to @joekaufmanexpensify ( |
Bug0 Triage Checklist (Main S/O)
|
I can reproduce this. I don't think we're really "removing" the formatting though when copying the code block. It's just that when it's pasted, there's a space between the last ` and ~. If the space is removed before you send the message you copied, we do show the strikethrough. |
Job added to Upwork: https://www.upwork.com/jobs/~012fc66a9c82073e51 |
Current assignee @joekaufmanexpensify is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat ( |
I am checking the processing rules to determine the expected behaviour. |
ProposalPlease re-state the problem that we are trying to solve in this issue.App removes strikethrough formatting on copy and resend for code block What is the root cause of that problem?When the "Edit Message" button is clicked, the raw text has a newline between the final ` and the second ~ which differs from the original raw message content. When a newline is introduced in this manner, the rule/pattern for strikethrough does not match. It seems that the code block is what causes the newlines to be inserted. Note that inserting newlines into any strikethrough message will cause the strikethrough to disappear. What changes do you think we should make in order to solve the problem?There are two options to solve this issue in my view. The first option is to make sure that when "Edit Message" is clicked, the raw text displayed is identical to the raw text that was sent originally (do not introduce newlines). The second option is to update the rule/pattern for strikethrough so that it also matches text that contains newlines. |
📣 @hurtdusk! 📣
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
ProposalPlease re-state the problem that we are trying to solve in this issue.While chatting with a user, if I send
What is the root cause of that problem?Regex used in What changes do you think we should make in order to solve the problem?One possible solution for this problem of adding new line after {
name: 'replacepre2',
regex: /<\/pre>(<\/.*>)(.)/gi,
replacement: '</pre>$1<br />$2',
} if we want it to be specific just for strike through Additionally, to handle the behaviour where {
name: 'replacepre',
regex: /<\/pre>(?!<\/.*>)(.)/gi,
replacement: '</pre><br />$1',
} This will add What alternative solutions did you explore? (Optional) |
Proposed solutionPlease re-state the problem that we are trying to solve in this issue.App removes strikethrough formatting on copy and resend for code block. What is the root cause of that problem? The root cause of this issue is that a line break is added after name: 'replacepre',
regex: /<\/pre>(.)/gi,
replacement: '</pre><br />$1',
Mark down converted to html <del><pre>some text</pre></del> Then html further converted as below due to htmlToMarkdownRules replacepre <del><pre>some text</pre><br /></del> What changes do you think we should make in order to solve the problem? Add a new rule to replace {
name: 'replacePreBrDel',
regex: /<\/pre><br \/><\/del>/gi,
replacement: '</pre></del>',
}, Input markdown
converted to html <del><pre>some text</pre></del> And
What alternative solutions did you explore? (Optional)This can also be solved by updating an existing regex of |
Proposals pending review |
I have stated reviewing this issue. |
Thanks! Yep, I saw. Just commented to make sure the issue doesn't go overdue today. |
Note to me: I think the root cause here is incorrect parsing of |
Sounds good! LMK if there's anything else I can help with as you review the proposals here. |
ProposalPlease re-state the problem that we are trying to solve in this issue.In chat - app removes strikethrough formatting on copy and resend for code block What is the root cause of that problem?When we've code block inside strike through And this HTML, gets converted back to below markup here ~```
Hello
```
~ However, above markdown doesn't get parsed as valid strikethrough section using regular expression here What changes do you think we should make in order to solve the problem?To fix this, we should change strikethrough rule regex here to below;
Explanation:
What alternative solutions did you explore? (Optional)None |
No update. Busy with critical issues. |
Hey I’m Michał from Software Mansion, an expert agency, and I will help close this issue out 😄 |
Go ahead. Thanks. |
@eh2077 Thanks for the proposal, I really like it. I think it is a good idea to keep the behavior of strikethrough consistent with the bold and italic. Also, I can't find striking through the code block on other apps. @parasharrajat what do you think about that? |
@Skalakid we can find striking through in code block on discord. and italic and bold as well |
@hurtdusk I'm not sure about the solution with passing raw text that was sent originally. However, updating the rule/pattern for strikethrough so that it also matches text that contains newlines, seems to be a good idea (if we want to keep striking through code blocks feature). Can you write more details about it, please? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
I am finally free from critical issues so I will be able to check the slack thread and update you. I haven't reviewed any proposals yet because I want to check if we are setting correct parsing rules. I opened a Slack thread but it didn't receive the needed interest so I will try to push it a little more. Currently, team is busy getting critical features out before the upcoming conference so it will take a few days before we can really move forward. Also, I don't want to make this change at this stage to prevent unexpected bugs while the App is being used by real users. So it means we have time till the conference to decide the correct solution. |
@mehvash-Khan I was testing your proposal and it fixes this bug but when I'm copying the strikethrough codeblock, it pastes with 2 new lines below it
|
@spcheema I tested your solution and I cant't make it work 😅 also I think it would be better to make it not only for |
@payal-lathidadiya Thanks for the proposal, however I'm not sure if we want to edit strikethrough rule. On many apps such a behavior is blocked and you can't add text formatting tag when its end is the beginning of the new line (for example on GitHub/Slack). ~hello |
@Skalakid Here is a draft for testing based on the solution I proposed earlier: Expensify/expensify-common#572 Made some changes in the proposal where only one rule is required to fix the issue. |
Still pending discussions |
Expected Behaviour:
will be parsed as follows
|
Hey everyone, I have posted the expected behavior above based on the slack thread. Let me know if something looks off. If everything looks good, let's modify the OP and add this there in the expected section @joekaufmanexpensify Please repost your proposals if old one works. |
Please hold your proposals. I think there are a couple of issues with the nesting of rules that need a proper discussion and design. I have opened another thread to see what others think about it. https://expensify.slack.com/archives/C02NK2DQWUX/p1694008860474759 https://expensify.slack.com/archives/C02NK2DQWUX/p1694009190325299 |
Sounds good! |
@parasharrajat is there anyone specific you're looking for input from on those threads? If so, I'm happy to just tag them so we can try to push this forward. |
I don't want to forcefully pull anyone into the discussion. I hope that the engineering team will be interested in participating. You know the team better than me so please tag the persons you want to. |
I'm sure people will be interested! Just concerned the thread might have gotten buried in the room. I see there's been more input, but I will bump it now. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Closing in favor of #27208 |
Hi @thienlnam, you have written the same issue number in your message, maybe you were marking any other issue? |
Updated, thanks |
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:
Hello
Expected Result:
App should keep the format of text same when we copy it to clipboard or copy from edit message and resend the message
Actual Result:
App does not keep the format of strikethrough on code block on copy to clipboard or copy from edit message and resend the message
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.41-2
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
removes.strikethrough.on.copy.and.resend.mp4
Recording.3706.mp4
Expensify/Expensify Issue URL:
Issue reported by: GH handle - @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1689525870441879
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: