[Glitch] fix: sensitive media card display
Port 40bf2dca1e41cb5aeaae933ae886fc02d8fa7d56 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
bbbbb24dbd
commit
e5cf23b3b5
@ -11,7 +11,7 @@ import { Blurhash } from 'flavours/glitch/components/blurhash';
|
||||
import { Icon } from 'flavours/glitch/components/icon';
|
||||
import { MoreFromAuthor } from 'flavours/glitch/components/more_from_author';
|
||||
import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp';
|
||||
import { useBlurhash } from 'flavours/glitch/initial_state';
|
||||
import { displayMedia, useBlurhash } from 'flavours/glitch/initial_state';
|
||||
import type { Card as CardType } from 'flavours/glitch/models/status';
|
||||
import { decode as decodeIDNA } from 'flavours/glitch/utils/idna';
|
||||
|
||||
@ -49,6 +49,8 @@ const handleIframeUrl = (html: string, url: string, providerName: string) => {
|
||||
return html;
|
||||
};
|
||||
|
||||
const hideAllMedia = displayMedia === 'hide_all';
|
||||
|
||||
interface CardProps {
|
||||
card: CardType | null;
|
||||
sensitive?: boolean;
|
||||
@ -73,7 +75,7 @@ const CardVideo: React.FC<Pick<CardProps, 'card'>> = ({ card }) => (
|
||||
const Card: React.FC<CardProps> = ({ 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);
|
||||
@ -269,6 +271,7 @@ const Card: React.FC<CardProps> = ({ card, sensitive }) => {
|
||||
embed = (
|
||||
<div className='status-card__image'>
|
||||
{canvas}
|
||||
{revealed ? undefined : spoilerButton}
|
||||
{thumbnail}
|
||||
</div>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user