pl-fe: treat media with spoiler text as sensitive
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
3333254b01
commit
3a8ac75801
1 changed files with 4 additions and 4 deletions
|
@ -9,8 +9,8 @@ import { Button, HStack, Text } from '../ui';
|
||||||
|
|
||||||
import type { Status } from 'pl-fe/normalizers';
|
import type { Status } from 'pl-fe/normalizers';
|
||||||
|
|
||||||
const isMediaVisible = (status: Pick<Status, 'hidden' | 'media_attachments' | 'sensitive'>, displayMedia: 'default' | 'show_all' | 'hide_all') => {
|
const isMediaVisible = (status: Pick<Status, 'hidden' | 'media_attachments' | 'sensitive' | 'spoiler_text'>, displayMedia: 'default' | 'show_all' | 'hide_all') => {
|
||||||
let visible = !status.sensitive;
|
let visible = !(status.sensitive || status.spoiler_text);
|
||||||
|
|
||||||
if (status.hidden !== null) visible = !status.hidden;
|
if (status.hidden !== null) visible = !status.hidden;
|
||||||
else if (displayMedia === 'show_all') visible = true;
|
else if (displayMedia === 'show_all') visible = true;
|
||||||
|
@ -19,7 +19,7 @@ const isMediaVisible = (status: Pick<Status, 'hidden' | 'media_attachments' | 's
|
||||||
return visible;
|
return visible;
|
||||||
};
|
};
|
||||||
|
|
||||||
const showOverlay = (status: Pick<Status, 'hidden' | 'media_attachments' | 'sensitive'>, displayMedia: 'default' | 'show_all' | 'hide_all') => {
|
const showOverlay = (status: Pick<Status, 'hidden' | 'media_attachments' | 'sensitive' | 'spoiler_text'>, displayMedia: 'default' | 'show_all' | 'hide_all') => {
|
||||||
const visible = isMediaVisible(status, displayMedia);
|
const visible = isMediaVisible(status, displayMedia);
|
||||||
|
|
||||||
const showHideButton = status.sensitive || (status.media_attachments.length && displayMedia === 'hide_all');
|
const showHideButton = status.sensitive || (status.media_attachments.length && displayMedia === 'hide_all');
|
||||||
|
@ -39,7 +39,7 @@ const messages = defineMessages({
|
||||||
});
|
});
|
||||||
|
|
||||||
interface ISensitiveContentOverlay {
|
interface ISensitiveContentOverlay {
|
||||||
status: Pick<Status, 'id' | 'sensitive' | 'hidden' | 'media_attachments' | 'currentLanguage'>;
|
status: Pick<Status, 'id' | 'sensitive' | 'spoiler_text' | 'hidden' | 'media_attachments' | 'currentLanguage'>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SensitiveContentOverlay = React.forwardRef<HTMLDivElement, ISensitiveContentOverlay>((props, ref) => {
|
const SensitiveContentOverlay = React.forwardRef<HTMLDivElement, ISensitiveContentOverlay>((props, ref) => {
|
||||||
|
|
Loading…
Reference in a new issue