Conversation
…oneboxes Two issues with Twitter/X oneboxes: 1. Adding `x.com` or `twitter.com` to `blocked_onebox_domains` had no effect. In `FinalDestination#resolve`, domains in the `ignore_redirects` list (which includes x.com, twitter.com, youtube.com, etc.) trigger an early return with `:resolved` status before `blocked_domain?` is ever checked. This made it impossible to block oneboxes for any of these domains. The fix adds the blocked domain check before the `ignore_redirects` shortcut in `resolve()`. 2. When X/Twitter returns no useful Open Graph metadata (which is the current real-world behavior without API credentials), the onebox rendered an empty shell — an `<aside>` with blank title, empty tweet div, and no timestamp. `TwitterStatusOnebox` had no field validation unlike other engines (e.g. `AmazonOnebox`). The fix adds a `verified_data` method that requires `title` and `tweet` to be present, returning empty HTML when they're missing. This causes Discourse to fall back to a plain link instead of rendering a broken onebox. https://meta.discourse.org/t/397516
pmusaraj
approved these changes
Mar 25, 2026
Contributor
|
Spec failure looks like a flake. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two issues with Twitter/X oneboxes:
Adding
x.comortwitter.comtoblocked_onebox_domainshad no effect. InFinalDestination#resolve, domains in theignore_redirectslist (which includes x.com, twitter.com, youtube.com, etc.) trigger an early return with:resolvedstatus beforeblocked_domain?is ever checked. This made it impossible to block oneboxes for any of these domains. The fix adds the blocked domain check before theignore_redirectsshortcut inresolve().When X/Twitter returns no useful Open Graph metadata (which is the current real-world behavior without API credentials), the onebox rendered an empty shell — an
<aside>with blank title, empty tweet div, and no timestamp.TwitterStatusOneboxhad no field validation unlike other engines (e.g.AmazonOnebox). The fix adds averified_datamethod that requirestitleandtweetto be present, returning empty HTML when they're missing. This causes Discourse to fall back to a plain link instead of rendering a broken onebox.https://meta.discourse.org/t/397516