fix: Hide preview cards on all posts with content warnings#2302
Merged
Conversation
A `Status` has a `spoiler_text` property and a `sensitive` property. On the web UI Mastodon, if you create a `Status` with spoiler text the `sensitive` property is set to `true`. This is front end behaviour, not something enforced by the API. The previous code was assuming that `sensitive` being `true` also meant there was spoiler text, and vice-versa, but this is not the case, all four possible options are possible (empty/non-empty spoiler text x true/false sensitive property). This meant that a preview card on a `Status` with `spoiler_text` but not marked `sensitive` would still be displayed. Re-write the code to control whether the `Status` body is displayed to use the `spoiler_text` property exclusively. The `sensitive` property is still used to determine how to display images in preview cards. Fixes pachli#2280
da13727 to
fe4a7f9
Compare
nikclayton
added a commit
that referenced
this pull request
Jun 6, 2026
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.
A
Statushas aspoiler_textproperty and asensitiveproperty.On the web UI Mastodon, if you create a
Statuswith spoiler text thesensitiveproperty is set totrue. This is front end behaviour, not something enforced by the API.The previous code was assuming that
sensitivebeingtruealso meant there was spoiler text, and vice-versa, but this is not the case, all four possible options are possible (empty/non-empty spoiler text x true/false sensitive property).This meant that a preview card on a
Statuswithspoiler_textbut not markedsensitivewould still be displayed.Re-write the code to control whether the
Statusbody is displayed to use thespoiler_textproperty exclusively.The
sensitiveproperty is still used to determine how to display images in preview cards.Fixes #2280