App icon indicating copy to clipboard operation
App copied to clipboard

Formatting of email responses in NewDot isn't pretty

Open mvtglobally opened this issue 4 years ago • 36 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

@greeny was sending messages back/forth to a business partner

Expected Result:

When the partner replied via email that the formatting would like nice and there wouldn't be extra line breaks

Actual Result:

Formatting is a bit janky, inc. extra line breaks

Workaround:

unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.1.41-3 Reproducible in staging?: need repro Reproducible in production?: Y Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation image - 2022-03-11T000521 922

Expensify/Expensify Issue URL: Issue reported by: @mallenexpensify Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1646931708047189

View all open jobs on GitHub

mvtglobally avatar Mar 11 '22 05:03 mvtglobally

Triggered auto assignment to @MariaHCD (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Mar 11 '22 05:03 MelvinBot

I think this could be an issue on the backend when parsing the response (and thus, possibly not something an external contributor could work on)

@zsgreenwald Would you mind DM'ing me more details (eg. the user's email) so I can investigate further via the logs and possibly on Mailgun as well?

MariaHCD avatar Mar 14 '22 15:03 MariaHCD

On it!

zsgreenwald avatar Mar 14 '22 22:03 zsgreenwald

Looks like we ran into something similar here: https://github.com/Expensify/Expensify/issues/142335

Looking at the logs for the user that @zsgreenwald sent over via DM, looks like we defaulted to mailgun's stripped HTML content instead of parsing it ourselves:

Email request is either using VML/XML namespaces or is from an unknown provider, relying on mailgun's stripped HTML content

cc: @thienlnam Not sure if we can do anything here?

MariaHCD avatar Mar 15 '22 15:03 MariaHCD

Yeah, not much we can do here unless we try to strip it ourselves which leads to endless things we'd have to account for. Since mailgun email stripping has been unreliable we can look into using another library for this except we'd need to test multiple platforms to make sure it works and isn't stripping out text content. We can also strip out whitespace after stripped HTML but that also leads to some unintended changes in other email providers

thienlnam avatar Mar 15 '22 18:03 thienlnam

Thanks, @thienlnam! So it sounds like:

Option 1: Strip the content ourselves (which would be tricky due to the endless number of mail providers that we'd have to account for)

Option 2: Investigate usage of another library (which would entail lots of tests across multiple platforms to ensure the text content isn't being stripped)

Option 3:

We can also strip out whitespace after stripped HTML but that also leads to some unintended changes in other email providers

Could you elaborate on those unintended changes? Maybe we can trim any whitespaces before and after the stripped HTML?

MariaHCD avatar Mar 16 '22 11:03 MariaHCD

Yup those options are correct, I think option 2 would actually be worthwhile to do

Could you elaborate on those unintended changes?

It's been a while so I might not be remembering correctly, but IIRC stripping whitespace messed up the email formatting inside the email and made (yahoo?) emails look especially bad. I think we had this enabled at one point but decided to revert it.

Maybe we can trim any whitespaces before and after the stripped HTML?

Yeah this could help a bit, though it looks like in the linked issue the spacing is bad between text and before/after the text too and so it would still look bad

thienlnam avatar Mar 16 '22 18:03 thienlnam

Great, thanks, @thienlnam! So moving forward, sounds like the best option would be to investigate usage of another library and this is something that can be handled internally as it is a backend change.

MariaHCD avatar Mar 21 '22 08:03 MariaHCD

Triggered auto assignment to @NicMendonca (Internal) because issue was reported by a contributor who needs to be compensated if this issue is fixed

melvin-bot[bot] avatar Mar 21 '22 10:03 melvin-bot[bot]

Triggered auto assignment to @NicMendonca (Internal) because issue was reported by a contributor who needs to be compensated if this issue is fixed

This issue was not reported by a contributor.

MariaHCD avatar Mar 21 '22 10:03 MariaHCD

I worked in this in the past in this PR. I added a function to trim the html, but it missed to consider cases where there are spaces using &nsbp;. I'll do a PR to fix that.

aldo-expensify avatar Apr 08 '22 20:04 aldo-expensify

This issue has not been updated in over 15 days. @aldo-expensify 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!

melvin-bot[bot] avatar May 09 '22 20:05 melvin-bot[bot]

@aldo-expensify @MariaHCD what's the latest with this? I'm still noticing some heavily spaced formatting on incoming messages from email. Some screenshots below:

image

image

zsgreenwald avatar May 11 '22 22:05 zsgreenwald

Hey @zsgreenwald , I made a PR, but it seems like it didn't work in this case. I'll have a look and see what it may be

aldo-expensify avatar May 11 '22 22:05 aldo-expensify

Thanks! Let me know if there's anything i can do to help

zsgreenwald avatar May 11 '22 22:05 zsgreenwald

@zsgreenwald do you get these messages also in your email inbox? or just new dot? Having the email to test with would help :)

aldo-expensify avatar May 11 '22 22:05 aldo-expensify

Just NewDot. I haven't received any email summaries from these Chats specifically

zsgreenwald avatar May 13 '22 00:05 zsgreenwald

Hey @aldo-expensify what else do you need from me to push this forward? Thanks!

zsgreenwald avatar May 17 '22 02:05 zsgreenwald

I'll put some time tomorrow to see if I can figure it out.

aldo-expensify avatar May 17 '22 02:05 aldo-expensify

Sorry for missing something -- what is the exact problem? Is it extra whitespace? Can someone describe specifically what they would like changed?

quinthar avatar May 17 '22 04:05 quinthar