|
|
@ -18,7 +18,6 @@ import classNames from 'classnames'; |
|
|
|
import Icon from 'mastodon/components/icon'; |
|
|
|
import Icon from 'mastodon/components/icon'; |
|
|
|
import PollContainer from 'mastodon/containers/poll_container'; |
|
|
|
import PollContainer from 'mastodon/containers/poll_container'; |
|
|
|
import { displayMedia } from '../initial_state'; |
|
|
|
import { displayMedia } from '../initial_state'; |
|
|
|
import { is } from 'immutable'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We use the component (and not the container) since we do not want
|
|
|
|
// We use the component (and not the container) since we do not want
|
|
|
|
// to use the progress bar to show download progress
|
|
|
|
// to use the progress bar to show download progress
|
|
|
@ -101,6 +100,7 @@ class Status extends ImmutablePureComponent { |
|
|
|
|
|
|
|
|
|
|
|
state = { |
|
|
|
state = { |
|
|
|
showMedia: defaultMediaVisibility(this.props.status), |
|
|
|
showMedia: defaultMediaVisibility(this.props.status), |
|
|
|
|
|
|
|
statusId: undefined, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Track height changes we know about to compensate scrolling
|
|
|
|
// Track height changes we know about to compensate scrolling
|
|
|
@ -116,9 +116,14 @@ class Status extends ImmutablePureComponent { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps (nextProps) { |
|
|
|
static getDerivedStateFromProps(nextProps, prevState) { |
|
|
|
if (!is(nextProps.status, this.props.status) && nextProps.status) { |
|
|
|
if (nextProps.status && nextProps.status.get('id') !== prevState.statusId) { |
|
|
|
this.setState({ showMedia: defaultMediaVisibility(nextProps.status) }); |
|
|
|
return { |
|
|
|
|
|
|
|
showMedia: defaultMediaVisibility(nextProps.status), |
|
|
|
|
|
|
|
statusId: nextProps.status.get('id'), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|