diff --git a/packages/pl-fe/src/components/attachment-thumbs.tsx b/packages/pl-fe/src/components/attachment-thumbs.tsx index d17c68f4c..466adc57f 100644 --- a/packages/pl-fe/src/components/attachment-thumbs.tsx +++ b/packages/pl-fe/src/components/attachment-thumbs.tsx @@ -2,31 +2,36 @@ import React, { Suspense } from 'react'; import { openModal } from 'pl-fe/actions/modals'; import { MediaGallery } from 'pl-fe/features/ui/util/async-components'; -import { useAppDispatch } from 'pl-fe/hooks'; +import { useAppDispatch, useSettings } from 'pl-fe/hooks'; + +import { isMediaVisible } from './statuses/sensitive-content-overlay'; import type { MediaAttachment } from 'pl-api'; +import type { Status } from 'pl-fe/normalizers'; interface IAttachmentThumbs { - media: Array; + status: Pick; onClick?(): void; - sensitive?: boolean; } -const AttachmentThumbs = (props: IAttachmentThumbs) => { - const { media, onClick } = props; +const AttachmentThumbs = ({ status, onClick }: IAttachmentThumbs) => { const dispatch = useAppDispatch(); + const { displayMedia } = useSettings(); const fallback =
; const onOpenMedia = (media: Array, index: number) => dispatch(openModal('MEDIA', { media, index })); + const visible = isMediaVisible(status, displayMedia); + return (
diff --git a/packages/pl-fe/src/components/status-media.tsx b/packages/pl-fe/src/components/status-media.tsx index a391c1267..0cf702bb9 100644 --- a/packages/pl-fe/src/components/status-media.tsx +++ b/packages/pl-fe/src/components/status-media.tsx @@ -55,7 +55,7 @@ const StatusMedia: React.FC = ({ if (muted) { media = ( ); diff --git a/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx b/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx index 36540e580..f9cd59c59 100644 --- a/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx +++ b/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx @@ -9,7 +9,7 @@ import { Button, HStack, Text } from '../ui'; import type { Status } from 'pl-fe/normalizers'; -const isMediaVisible = (status: Pick, displayMedia: 'default' | 'show_all' | 'hide_all') => { +const isMediaVisible = (status: Pick & { hidden?: boolean | null }, displayMedia: 'default' | 'show_all' | 'hide_all') => { let visible = !(status.sensitive || status.spoiler_text); if (status.hidden !== null) visible = !status.hidden; diff --git a/packages/pl-fe/src/features/compose/components/reply-indicator.tsx b/packages/pl-fe/src/features/compose/components/reply-indicator.tsx index 9f1833393..9c93b7d80 100644 --- a/packages/pl-fe/src/features/compose/components/reply-indicator.tsx +++ b/packages/pl-fe/src/features/compose/components/reply-indicator.tsx @@ -11,7 +11,7 @@ import type { Account, Status } from 'pl-fe/normalizers'; interface IReplyIndicator { className?: string; - status?: Pick & { account: Pick }; + status?: Pick & { account: Pick }; onCancel?: () => void; hideActions: boolean; } @@ -55,8 +55,7 @@ const ReplyIndicator: React.FC = ({ className, status, hideActi {status.media_attachments.length > 0 && ( )} diff --git a/packages/pl-fe/src/features/draft-statuses/components/draft-status.tsx b/packages/pl-fe/src/features/draft-statuses/components/draft-status.tsx index 526762cd3..d6c908f64 100644 --- a/packages/pl-fe/src/features/draft-statuses/components/draft-status.tsx +++ b/packages/pl-fe/src/features/draft-statuses/components/draft-status.tsx @@ -71,8 +71,7 @@ const DraftStatus: React.FC = ({ draftStatus, ...other }) => { {status.media_attachments.length > 0 && ( )} diff --git a/packages/pl-fe/src/features/scheduled-statuses/components/scheduled-status.tsx b/packages/pl-fe/src/features/scheduled-statuses/components/scheduled-status.tsx index 1e6888c95..fb3b99673 100644 --- a/packages/pl-fe/src/features/scheduled-statuses/components/scheduled-status.tsx +++ b/packages/pl-fe/src/features/scheduled-statuses/components/scheduled-status.tsx @@ -53,8 +53,7 @@ const ScheduledStatus: React.FC = ({ statusId, ...other }) => {status.media_attachments.length > 0 && ( )} diff --git a/packages/pl-fe/src/features/ui/components/modals/compare-history-modal.tsx b/packages/pl-fe/src/features/ui/components/modals/compare-history-modal.tsx index 5b943924f..202af419b 100644 --- a/packages/pl-fe/src/features/ui/components/modals/compare-history-modal.tsx +++ b/packages/pl-fe/src/features/ui/components/modals/compare-history-modal.tsx @@ -69,7 +69,7 @@ const CompareHistoryModal: React.FC = )} {version.media_attachments.length > 0 && ( - + )} diff --git a/packages/pl-fe/src/features/ui/components/modals/report-modal/index.tsx b/packages/pl-fe/src/features/ui/components/modals/report-modal/index.tsx index 2a296480f..f7c14d33e 100644 --- a/packages/pl-fe/src/features/ui/components/modals/report-modal/index.tsx +++ b/packages/pl-fe/src/features/ui/components/modals/report-modal/index.tsx @@ -58,10 +58,7 @@ const SelectedStatus = ({ statusId }: { statusId: string }) => { {status.media_attachments.length > 0 && ( - + )} );