FIX: Remove GitHub avatars from emails (PR #13536)

Rationale:

  1. these avatars are quite large (460x460px or so) and they end up being displayed in all their huge glory at the end of emails (in macOS Mail.app) when sent from a secure-uploads-enabled forum
  2. they were displayed in the wrong spot (due to float: left) in some cases, depending on viewport size and the rendering engine

Alternative solution: Disable them only when secure-uploads are enabled, and fix the positioning so that it works on small screen sizes/webkit.

GitHub

The spec failure is relevant. I’ll have to remove more code, but first I’d like to know whether to go down this path or to go toward the proposed alternative solution. @ZogStriP?

Can we instead add a class on the img tag in the onebox and use that to ensure the image has a max width / height?

That won’t do it. It is displayed at the correct size inline (see the screenshot) but Mail.app will display all attachments that are larger than some threshold. So we can either not include them (in certain cases or always), or resize them before sending (which isn’t really feasible)

Mail.app will display all attachments that are larger than some threshold.

Oh I hadn’t realized that. That’s a weird behavior… Are they doing it because the image we’re using for the avatar is actually (much) larger than what we’re displaying in the mail? Said otherwise: are we resizing the avatar using CSS?

I think I might change the approach here. I now noticed that the discourse avatar at the beginning of an email is hotlinked, and so should be the github avatar. (btw. I have a extremely strong sense of deja vu right now, because I feel like I typed this sentence before :joy:)

So the fix would be to prevent secure-uploads code from packaging up github avatars, and to fix invalid float: left position of these inline avatars.

And to answer the question - I think they’re simply displaying all attachments at the end. Including the images that are attached (Content-Disposition: attachment;) and are used in email’s html-part.

So the fix would be to prevent secure-uploads code from packaging up github avatars, and to fix invalid float: left position of these inline avatars.

:+1:

And to answer the question - I think they’re simply displaying all attachments at the end. Including the images that are attached (Content-Disposition: attachment;) and are used in email’s html-part.

Oh right. Makes sense.