Skip to content

fix: Hide preview cards on all posts with content warnings#2302

Merged
nikclayton merged 1 commit into
pachli:mainfrom
nikclayton:2280-hide-preview-card
May 24, 2026
Merged

fix: Hide preview cards on all posts with content warnings#2302
nikclayton merged 1 commit into
pachli:mainfrom
nikclayton:2280-hide-preview-card

Conversation

@nikclayton

Copy link
Copy Markdown
Contributor

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 #2280

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
@nikclayton nikclayton force-pushed the 2280-hide-preview-card branch from da13727 to fe4a7f9 Compare May 24, 2026 19:55
@nikclayton nikclayton merged commit 23d9b56 into pachli:main May 24, 2026
28 checks passed
@nikclayton nikclayton deleted the 2280-hide-preview-card branch May 24, 2026 20:49
nikclayton added a commit that referenced this pull request Jun 6, 2026
The refactoring in #2302
used `viewData.poll` instead of `viewData.actionable.poll`, so polls on
boosts were not shown.

Fixes #2316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link preview is shown outside from the closed CW

1 participant