Merge branch 'make-display-media-option-work' into 'develop'

Make display media option work properly, fixes #509

Closes #509

See merge request soapbox-pub/soapbox-fe!375
This commit is contained in:
Alex Gleason 2020-11-02 15:02:12 +00:00
commit 9ba703e4f9
2 changed files with 4 additions and 2 deletions

View file

@ -125,7 +125,7 @@ class Status extends ImmutablePureComponent {
static getDerivedStateFromProps(nextProps, prevState) { static getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.status && nextProps.status.get('id') !== prevState.statusId) { if (nextProps.status && nextProps.status.get('id') !== prevState.statusId) {
return { return {
showMedia: defaultMediaVisibility(nextProps.status), showMedia: defaultMediaVisibility(nextProps.status, nextProps.displayMedia),
statusId: nextProps.status.get('id'), statusId: nextProps.status.get('id'),
}; };
} else { } else {

View file

@ -110,6 +110,7 @@ const makeMapStateToProps = () => {
askReplyConfirmation: state.getIn(['compose', 'text']).trim().length !== 0, askReplyConfirmation: state.getIn(['compose', 'text']).trim().length !== 0,
domain: state.getIn(['meta', 'domain']), domain: state.getIn(['meta', 'domain']),
me: state.get('me'), me: state.get('me'),
displayMedia: getSettings(state).get('displayMedia'),
}; };
}; };
@ -133,11 +134,12 @@ class Status extends ImmutablePureComponent {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
askReplyConfirmation: PropTypes.bool, askReplyConfirmation: PropTypes.bool,
domain: PropTypes.string, domain: PropTypes.string,
displayMedia: PropTypes.string,
}; };
state = { state = {
fullscreen: false, fullscreen: false,
showMedia: defaultMediaVisibility(this.props.status), showMedia: defaultMediaVisibility(this.props.status, this.props.displayMedia),
loadedStatusId: undefined, loadedStatusId: undefined,
}; };