-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[$500] Chat - Reply chat notification email with markdown text does not show it in the app #34665
Comments
Job added to Upwork: https://www.upwork.com/jobs/~010f8f3d47ee75887e |
Triggered auto assignment to @zanyrenney ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia ( |
ProposalPlease re-state the problem that we are trying to solve in this issueEmail chat replay with markdown text is displayed without markdown. What is the root cause of that problem?The payload that comes from the the email client is not formatted the same as say a comment with markdown is formatted when posted via the composer, this causes the
This is the main issue but then we have another types of markdown that it's not parsed correctly via our ExpensiMark parser even though we remove the wrapping div mentioned above - the following will still not be parsed correctly: (found these cases by going line-by-line on our ExpensiMark markdown parser)
What changes do you think we should make in order to solve the problem?Within COMMENT_HTML_REGEX_MAP: {
'<div dir="ltr">|<\\/div>': '', // the initial wrapping div
'<a href="(.*)">(.*)<\\/a>': '$1', // when we post [some link](https://www.google.com) the email formatting adds a wrapping a tag around the link
'<br \\/>': '\n', // when we use newline in comment via email
'@mailto:': '@', // when we post [some email]([email protected]) // the email formatting adds `@mailto:` in front of the email
'>': '>', // the email replaces > with >
'<': '<', // the email replaces < with <
'mailto:': '', // for the ExpensiMark `autoEmail` case, the email formatting adds mailto: in front of it
} This will allow us to post all markdown that we can currently post via the composer, but from an email reply. VideosMacOS: Chrome / SafariScreen.Recording.2024-01-18.at.00.08.07.mov |
@thesahindia what do you think about the proposal above, can you review please? |
bump @thesahindia |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@ikevin127's proposal looks good to me! 🎀 👀 🎀 C+ reviewed |
Triggered auto assignment to @Beamanator, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Hmm I believe that proposal could work, but I also think this could be useful to try to "fix" / change in the backend, no? I think this would benefit from some internal investigation to figure out why / if we need this wrapping div, on email responses |
@Beamanator @thesahindia Actually, while I was testing my fix against our ExpensiMark library which parses markdown and I found out there's more than just the div that we have to remove in order to render the expected markdown in the chat. This is the regex map I came up with after going line-by-line against our ExpensiMark library source and sending all types of markdown from email reply: COMMENT_HTML_REGEX_MAP: {
'<div dir="ltr">|<\\/div>': '', // the initial wrapping div
'<a href="(.*)">(.*)<\\/a>': '$1', // when we post [some link](https://www.google.com) the email formatting adds a wrapping a tag around the link
'<br \\/>': '\n', // when we use newline in comment via email
'@mailto:': '@', // when we post [some email]([email protected]) // the email formatting adds `@mailto:` in front of the email
'>': '>', // the email replaces > with >
'<': '<', // the email replaces < with <
'mailto:': '', // for the ExpensiMark `autoEmail` case, the email formatting adds mailto: in front of it
} All these need to be replaced with their correct keys from the map in order to be rendered correctly as expected by the ExpensiMark in the front-end - which will match and align with the markdown we can send from the composer. Note: this happens regardless, because of how the email client is formatting different markdown. The back-end would basically have to do the exact same thing using this regex map and replace the email formatting.
Also a bug was introduced recently where the {
"html": "<div dir=\"ltr\"># Heading 1 from email</div>",
"lastModified": "2024-01-25 01:42:33.973",
"source": "email"
} so it becomes I accounted for this issue in the PR that is ready to be opened in case we decide to do this from the front-end side 🚀 Updated proposal
|
@Beamanator let us know what you think of the updated proposal with your feedback! |
Hmm here's my thoughts:
Hmm so @ikevin127 you're basically saying this mapping you created probably needs to be implemented in the client or backend side, right? What do you think @thesahindia @ikevin127 ? |
Fully agree with 1 and 2 🚀 As for 3 I will look into it as I don't think it's a typescript migration issue but something changed in that we're getting an object now instead of a string from the This is most likely coming from a parent up in the stack. 🔍 I will look into it and try to find what changed recently that prompted getting an object instead of a string for the Edit: looks like the
It can be done on either side, but it's less work if we process this in the front-end since the back-end, besides using the regex map to remove / replace the formatting added by the email client, I assume they would also have to format the response sent to the front-end to match the response we get when posting markdown via the composer. Ultimately, I'm cool with either side handling this - I'll leave it to your discretion 🙌 |
bump @Beamanator which path forward should we opt for? |
Thanks for your responses so far @ikevin127 ! One final potential concern I have is: We currently have 3 codebases for our 3 "front ends" - NewDot, OldDot, and OldApp. If we do this mapping in "the front end" won't we have to do the same mapping in all 3 places? |
This particular issue is targeting ND, beyond that it's above my knowledge. I guess for the other 2 FE codebases we have to ask the team if we even have any markdown posting capabilities in the chat. If not, a FE fix can work here. If not then there's no choice then to go with a BE fix. Edit: looks like we can post markdown in the OD chat too - but I did not check the reply from email for OD (not sure we have the functionality). |
@Beamanator @zanyrenney @thesahindia this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
@Beamanator any chance you can take a look at this one now please? |
@Beamanator, @zanyrenney, @thesahindia Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@zanyrenney this isn't part of a VIP or wave, so I haven't been prioritizing it - do you think I really need to get to work on it ASAP? It seems like an edge case, I don't know anyone who replies to emails using markdown 😅 |
@Beamanator @zanyrenney @thesahindia this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:
Thanks! |
Current assignee @thesahindia is eligible for the Internal assigner, not assigning anyone new. |
Fair challenge @Beamanator if we don't think this a priority, let's make it weekly for now then. |
is weekly still appropriate? @Beamanator |
Merp, good question - I honestly think |
changing to monthly as per the guideance above from @Beamanator |
I think we can close this based on this question from the BZ team analysis: |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.26-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:
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:
Markdown text should be displayed on the chat
Actual Result:
The text is displayed without markdown
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: