diff --git a/app/soapbox/features/account-gallery/index.tsx b/app/soapbox/features/account-gallery/index.tsx index 9fda9751f..b27d1b117 100644 --- a/app/soapbox/features/account-gallery/index.tsx +++ b/app/soapbox/features/account-gallery/index.tsx @@ -95,7 +95,7 @@ const AccountGallery = () => { const media = (attachment.status as Status).media_attachments; const index = media.findIndex((x) => x.id === attachment.id); - dispatch(openModal('MEDIA', { media, index, status: attachment.status, account: attachment.account })); + dispatch(openModal('MEDIA', { media, index, status: attachment.status })); } }; diff --git a/app/soapbox/features/ui/components/modals/media-modal.tsx b/app/soapbox/features/ui/components/modals/media-modal.tsx index bfd4ed29a..ff8b6b467 100644 --- a/app/soapbox/features/ui/components/modals/media-modal.tsx +++ b/app/soapbox/features/ui/components/modals/media-modal.tsx @@ -13,7 +13,7 @@ import Video from 'soapbox/features/video'; import ImageLoader from '../image-loader'; import type { List as ImmutableList } from 'immutable'; -import type { Account, Attachment, Status } from 'soapbox/types/entities'; +import type { Attachment, Status } from 'soapbox/types/entities'; const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, @@ -24,7 +24,6 @@ const messages = defineMessages({ interface IMediaModal { media: ImmutableList, status?: Status, - account: Account, index: number, time?: number, onClose: () => void, @@ -34,7 +33,6 @@ const MediaModal: React.FC = (props) => { const { media, status, - account, onClose, time = 0, } = props; @@ -94,9 +92,9 @@ const MediaModal: React.FC = (props) => { }; const handleStatusClick: React.MouseEventHandler = e => { - if (e.button === 0 && !(e.ctrlKey || e.metaKey)) { + if (status && e.button === 0 && !(e.ctrlKey || e.metaKey)) { e.preventDefault(); - history.push(`/@${account.acct}/posts/${status?.id}`); + history.push(`/@${status.getIn(['account', 'acct'])}/posts/${status?.id}`); onClose(); } }; @@ -170,7 +168,7 @@ const MediaModal: React.FC = (props) => { const width = (attachment.meta.getIn(['original', 'width']) || undefined) as number | undefined; const height = (attachment.meta.getIn(['original', 'height']) || undefined) as number | undefined; - const link = (status && account && ( + const link = (status && ( diff --git a/app/soapbox/features/ui/components/profile-media-panel.tsx b/app/soapbox/features/ui/components/profile-media-panel.tsx index 68c9987e5..cb71d777c 100644 --- a/app/soapbox/features/ui/components/profile-media-panel.tsx +++ b/app/soapbox/features/ui/components/profile-media-panel.tsx @@ -31,7 +31,7 @@ const ProfileMediaPanel: React.FC = ({ account }) => { const media = attachment.getIn(['status', 'media_attachments']) as ImmutableList; const index = media.findIndex(x => x.id === attachment.id); - dispatch(openModal('MEDIA', { media, index, status: attachment.status, account: attachment.account })); + dispatch(openModal('MEDIA', { media, index, status: attachment.status })); } };