From 741b27195e87cc399dc72fa1dd3e7cd04afa5602 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 12 Jun 2020 20:10:07 -0500 Subject: [PATCH] Account Gallery: Fix "view context" button, fixes #193 --- app/soapbox/features/account_gallery/index.js | 2 +- app/soapbox/features/ui/components/media_modal.js | 6 +++++- app/soapbox/selectors/index.js | 7 +++++-- app/styles/components/modal.scss | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/soapbox/features/account_gallery/index.js b/app/soapbox/features/account_gallery/index.js index caa361e3b..de2213b07 100644 --- a/app/soapbox/features/account_gallery/index.js +++ b/app/soapbox/features/account_gallery/index.js @@ -137,7 +137,7 @@ class AccountGallery extends ImmutablePureComponent { const media = attachment.getIn(['status', 'media_attachments']); const index = media.findIndex(x => x.get('id') === attachment.get('id')); - this.props.dispatch(openModal('MEDIA', { media, index, status: attachment.get('status') })); + this.props.dispatch(openModal('MEDIA', { media, index, status: attachment.get('status'), account: attachment.get('account') })); } } diff --git a/app/soapbox/features/ui/components/media_modal.js b/app/soapbox/features/ui/components/media_modal.js index e0cdc39c4..a209d8fee 100644 --- a/app/soapbox/features/ui/components/media_modal.js +++ b/app/soapbox/features/ui/components/media_modal.js @@ -25,6 +25,7 @@ class MediaModal extends ImmutablePureComponent { static propTypes = { media: ImmutablePropTypes.list.isRequired, status: ImmutablePropTypes.map, + account: ImmutablePropTypes.map, index: PropTypes.number.isRequired, onClose: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, @@ -110,7 +111,10 @@ class MediaModal extends ImmutablePureComponent { handleStatusClick = e => { 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')}`); + const { status, account } = this.props; + const acct = account.get('acct'); + const statusId = status.get('id'); + this.context.router.history.push(`/@${acct}/posts/${statusId}`); } } diff --git a/app/soapbox/selectors/index.js b/app/soapbox/selectors/index.js index 0ee8a7ca4..0353cd177 100644 --- a/app/soapbox/selectors/index.js +++ b/app/soapbox/selectors/index.js @@ -135,11 +135,14 @@ export const makeGetNotification = () => { export const getAccountGallery = createSelector([ (state, id) => state.getIn(['timelines', `account:${id}:media`, 'items'], ImmutableList()), state => state.get('statuses'), -], (statusIds, statuses) => { + state => state.get('accounts'), +], (statusIds, statuses, accounts) => { return statusIds.reduce((medias, statusId) => { const status = statuses.get(statusId); + const account = accounts.get(status.get('account')); if (status.get('reblogged') !== false) return medias; - return medias.concat(status.get('media_attachments').map(media => media.set('status', status))); + return medias.concat(status.get('media_attachments') + .map(media => media.merge({ status, account }))); }, ImmutableList()); }); diff --git a/app/styles/components/modal.scss b/app/styles/components/modal.scss index c0d22c5ce..6d1cf7c5c 100644 --- a/app/styles/components/modal.scss +++ b/app/styles/components/modal.scss @@ -143,7 +143,7 @@ a { text-decoration: none; font-weight: 500; - color: var(--background-color); + color: #fff; &:hover, &:focus,