Youtube thumbnail fails to show up on Topic List for e.g. Fakebook theme, TLP plugin.
STR:
Post a youtube video, switch to Fakebook Theme, no thumbnail appears.
Workaround:
Rebuild the post and the thumbnail appears, however, given users are expecting the thumbnail to appear imminently without staff intervention, this is not a great solution.
More info:
Topic.image_url appears to be nil
This seems to have broken recently, after beginning of August … I think this worked before August the 5th (but not sure when it actually broke). I’ve noticed this aligns roughly with a new version of Onebox …
I tested this on a prior build and the issue was not present, ruling out Youtube og responses I hope. Also Fakebook theme shows the same behaviour as TLP plugin, ruling out TLP plugin, so I do suspect it’s a recent regression in Discourse or Onebox.
This is a real issue for users of Topic List Previews.
@nbianca why did we don’t use the post.post_analyzer.found_oneboxes? method anymore in here?
All oneboxes which use either oembed or iframe will fail the new CSS selector mode, and that also makes our Onebox detector be different across the codebase.
The problem was that the First Onebox was awarded for any posted link, no matter if it was or was not a Onebox. This happens because PrettyText adds class="onebox" to all links and then Oneboxer tries to parse all links with class onebox.
The change I made checks if the final document has any Oneboxes (Oneboxes are aside with class onebox). I will have another look and see what and why is it broken and come back with a change that fixes both of the issues.
I just tested v2.3.2 and it does not look like YouTube links set the image_url attribute of the topic. The reason is that the image is extracted from the src attribute of an img, but when a YouTube video is linked, there is a <div> with a background-image CSS attribute.