Thumbnails are missing for our external embeds when using topic-thumbnails

After some discussion with the Discourse team at email, I’m updating here.

The main discovery is that thumbnails are not loaded if a link which becomes a onebox is rendered as an iframe.

This means that the link:

https://app.everviz.com/embed/N0dDTJaOQ

Will and will not render a thumbnail depending on whether iframes are allowed from the domain (allowed iframes). The solution to this is to somehow inject an iframe to the post. I made a plugin which does so, and makes sure display: none is set on the image, to prevent it from appearing in the post.

I imagine it is possible to generalize this to either:

  1. For all generic oneboxes, silently load and hide an image next to it if get_oembed.thumbnail_url exists.
  2. Arguably a better solution, add general support for extracting get_oembed.thumbnail_url and associating it with the post, without it being part of the cooked area itself.

Relavant places:

  1. https://oembed.com/
  2. discourse/lib/onebox/engine at main · discourse/discourse · GitHub
  3. discourse/lib/onebox/engine/standard_embed.rb at main · discourse/discourse · GitHub

I am not super happy about this modal behavior, that is, is allowed iframes enabled or not? It would be nice if Discourse extracts and makes use of all properties from a given oembed endpoint when it first sends a GET to it.