Make display media option work properly

This commit is contained in:
Sean King
2020-10-29 08:41:43 -06:00
parent c59ad985e5
commit 3a1bb8f19b
2 changed files with 5 additions and 1 deletions

View File

@ -112,6 +112,7 @@ class Status extends ImmutablePureComponent {
// Track height changes we know about to compensate scrolling
componentDidMount() {
this.didShowCard = !this.props.muted && !this.props.hidden && this.props.status && this.props.status.get('card');
this.setState({ showMedia: defaultMediaVisibility(this.props.status, this.props.displayMedia) });
}
getSnapshotBeforeUpdate() {

View File

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