oembed: ignore oembed results from mastodon #19286
Open
+29
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

This adds a check in the oembed preview for cases where the oembed is going to contain less information than the OpenGraph; in these cases, the oembed is ignored and the OpenGraph data is retained. At the moment, the only case in here is Mastodon posts, but it could be expanded in the future.
Mastodon's oembed is JavaScript based and only contains stub HTML that's intended to be filled in by client-side JavaScript that synapse doesn't execute. It doesn't contain the actual post text. The og:description, on the other hand, does contain the post text. When synapse unilaterally prefers the oembed over OpenGraph, it ends up accidentally filling in a generic and non-useful preview in place of the actual post content.
See mastodon/mastodon#34710 for context.
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.