From 40bf2dca1e41cb5aeaae933ae886fc02d8fa7d56 Mon Sep 17 00:00:00 2001 From: Nishiki Date: Thu, 11 Jun 2026 01:14:53 -0700 Subject: [PATCH] fix: sensitive media card display (#39366) --- .../mastodon/features/status/components/card.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/features/status/components/card.tsx b/app/javascript/mastodon/features/status/components/card.tsx index 68eea5ea36..525929625e 100644 --- a/app/javascript/mastodon/features/status/components/card.tsx +++ b/app/javascript/mastodon/features/status/components/card.tsx @@ -13,7 +13,7 @@ import { Blurhash } from 'mastodon/components/blurhash'; import { Icon } from 'mastodon/components/icon'; import { MoreFromAuthor } from 'mastodon/components/more_from_author'; import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; -import { useBlurhash } from 'mastodon/initial_state'; +import { displayMedia, useBlurhash } from 'mastodon/initial_state'; import type { Card as CardType } from 'mastodon/models/status'; const IDNA_PREFIX = 'xn--'; @@ -63,6 +63,8 @@ const handleIframeUrl = (html: string, url: string, providerName: string) => { return html; }; +const hideAllMedia = displayMedia === 'hide_all'; + interface CardProps { card: CardType | null; sensitive?: boolean; @@ -87,7 +89,7 @@ const CardVideo: React.FC> = ({ card }) => ( const Card: React.FC = ({ card, sensitive }) => { const [previewLoaded, setPreviewLoaded] = useState(false); const [embedded, setEmbedded] = useState(false); - const [revealed, setRevealed] = useState(!sensitive); + const [revealed, setRevealed] = useState(!sensitive && !hideAllMedia); const handleEmbedClick = useCallback(() => { setEmbedded(true); @@ -283,6 +285,7 @@ const Card: React.FC = ({ card, sensitive }) => { embed = (
{canvas} + {revealed ? undefined : spoilerButton} {thumbnail}
);