web/timeline: fix media spoilers

Closes #567
This commit is contained in:
Tulir Asokan 2024-12-25 14:04:18 +02:00
parent 7cad53bb7d
commit eda7d6790e
2 changed files with 8 additions and 1 deletions

View file

@ -59,7 +59,10 @@ const MediaMessageBody = ({ event, room, sender }: EventContentProps) => {
} }
} }
const renderMediaElem = !supportsClickToShow || showPreviewsByDefault || clickedShow const renderMediaElem = !supportsClickToShow || showPreviewsByDefault || clickedShow
const renderPlaceholderElem = supportsClickToShow && (!renderMediaElem || !!contentWarning || !loaded) const renderPlaceholderElem = supportsClickToShow
&& (!renderMediaElem
|| (contentWarning && !clickedShow)
|| !loaded)
const isLoadingOnlyCover = !loaded && !contentWarning && renderMediaElem const isLoadingOnlyCover = !loaded && !contentWarning && renderMediaElem
const [mediaContent, containerClass, containerStyle] = useMediaContent(content, event.type, undefined, onLoad) const [mediaContent, containerClass, containerStyle] = useMediaContent(content, event.type, undefined, onLoad)

View file

@ -215,6 +215,10 @@ div.media-container {
border-radius: .25rem; border-radius: .25rem;
} }
&:has(> div.empty-placeholder) + img {
filter: blur(16px);
}
& + img { & + img {
/* In order loading=lazy to work, the image has to be visible, /* In order loading=lazy to work, the image has to be visible,
so put it behind the placeholder instead of below */ so put it behind the placeholder instead of below */