Account Gallery: Fix "view context" button, fixes #193
This commit is contained in:
parent
aa0a4e49be
commit
741b27195e
|
@ -137,7 +137,7 @@ class AccountGallery extends ImmutablePureComponent {
|
||||||
const media = attachment.getIn(['status', 'media_attachments']);
|
const media = attachment.getIn(['status', 'media_attachments']);
|
||||||
const index = media.findIndex(x => x.get('id') === attachment.get('id'));
|
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') }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ class MediaModal extends ImmutablePureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
media: ImmutablePropTypes.list.isRequired,
|
media: ImmutablePropTypes.list.isRequired,
|
||||||
status: ImmutablePropTypes.map,
|
status: ImmutablePropTypes.map,
|
||||||
|
account: ImmutablePropTypes.map,
|
||||||
index: PropTypes.number.isRequired,
|
index: PropTypes.number.isRequired,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
|
@ -110,7 +111,10 @@ class MediaModal extends ImmutablePureComponent {
|
||||||
handleStatusClick = e => {
|
handleStatusClick = e => {
|
||||||
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||||
e.preventDefault();
|
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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,11 +135,14 @@ export const makeGetNotification = () => {
|
||||||
export const getAccountGallery = createSelector([
|
export const getAccountGallery = createSelector([
|
||||||
(state, id) => state.getIn(['timelines', `account:${id}:media`, 'items'], ImmutableList()),
|
(state, id) => state.getIn(['timelines', `account:${id}:media`, 'items'], ImmutableList()),
|
||||||
state => state.get('statuses'),
|
state => state.get('statuses'),
|
||||||
], (statusIds, statuses) => {
|
state => state.get('accounts'),
|
||||||
|
], (statusIds, statuses, accounts) => {
|
||||||
|
|
||||||
return statusIds.reduce((medias, statusId) => {
|
return statusIds.reduce((medias, statusId) => {
|
||||||
const status = statuses.get(statusId);
|
const status = statuses.get(statusId);
|
||||||
|
const account = accounts.get(status.get('account'));
|
||||||
if (status.get('reblogged') !== false) return medias;
|
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());
|
}, ImmutableList());
|
||||||
});
|
});
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--background-color);
|
color: #fff;
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus,
|
&:focus,
|
||||||
|
|
Loading…
Reference in New Issue