From 9d78e1a448c2a0ce77cce564988ceed022a23419 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 2 Apr 2021 17:01:39 -0500 Subject: [PATCH] Fix media context button for videos, fixes #606 --- app/soapbox/features/account_gallery/index.js | 2 +- app/soapbox/features/ui/components/media_modal.js | 4 ++-- app/soapbox/features/ui/components/video_modal.js | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/soapbox/features/account_gallery/index.js b/app/soapbox/features/account_gallery/index.js index 70552a642..c127e0d9b 100644 --- a/app/soapbox/features/account_gallery/index.js +++ b/app/soapbox/features/account_gallery/index.js @@ -133,7 +133,7 @@ class AccountGallery extends ImmutablePureComponent { handleOpenMedia = attachment => { if (attachment.get('type') === 'video') { - this.props.dispatch(openModal('VIDEO', { media: attachment, status: attachment.get('status') })); + this.props.dispatch(openModal('VIDEO', { media: attachment, status: attachment.get('status'), account: attachment.get('account') })); } else { const media = attachment.getIn(['status', 'media_attachments']); const index = media.findIndex(x => x.get('id') === attachment.get('id')); diff --git a/app/soapbox/features/ui/components/media_modal.js b/app/soapbox/features/ui/components/media_modal.js index d0e4a2f9e..9ae762586 100644 --- a/app/soapbox/features/ui/components/media_modal.js +++ b/app/soapbox/features/ui/components/media_modal.js @@ -120,7 +120,7 @@ class MediaModal extends ImmutablePureComponent { } render() { - const { media, status, intl, onClose } = this.props; + const { media, status, account, intl, onClose } = this.props; const { navigationHidden } = this.state; const index = this.getIndex(); @@ -150,7 +150,7 @@ class MediaModal extends ImmutablePureComponent { const content = media.map((image) => { const width = image.getIn(['meta', 'original', 'width']) || null; const height = image.getIn(['meta', 'original', 'height']) || null; - const link = (status && ); + const link = (status && account && ); if (image.get('type') === 'image') { return ( diff --git a/app/soapbox/features/ui/components/video_modal.js b/app/soapbox/features/ui/components/video_modal.js index e0aecb669..20bedb48a 100644 --- a/app/soapbox/features/ui/components/video_modal.js +++ b/app/soapbox/features/ui/components/video_modal.js @@ -12,6 +12,7 @@ export default class VideoModal extends ImmutablePureComponent { static propTypes = { media: ImmutablePropTypes.map.isRequired, status: ImmutablePropTypes.map, + account: ImmutablePropTypes.map, time: PropTypes.number, onClose: PropTypes.func.isRequired, }; @@ -43,16 +44,17 @@ export default class VideoModal extends ImmutablePureComponent { } handleStatusClick = e => { + const { status, account } = this.props; if (e.button === 0 && !(e.ctrlKey || e.metaKey)) { e.preventDefault(); - this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}/posts/${this.props.status.get('id')}`); + this.context.router.history.push(`/@${account.get('acct')}/posts/${status.get('id')}`); } } render() { - const { media, status, time, onClose } = this.props; + const { media, status, account, time, onClose } = this.props; - const link = status && ; + const link = status && account && ; return (