|
|
|
@ -41,7 +41,7 @@ import { openModal } from '../../actions/modal'; |
|
|
|
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; |
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component'; |
|
|
|
|
import { HotKeys } from 'react-hotkeys'; |
|
|
|
|
import { boostModal, deleteModal } from '../../initial_state'; |
|
|
|
|
import { boostModal, deleteModal, displayMedia } from '../../initial_state'; |
|
|
|
|
import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen'; |
|
|
|
|
import { textForScreenReader } from '../../components/status'; |
|
|
|
|
import Icon from 'mastodon/components/icon'; |
|
|
|
@ -131,6 +131,7 @@ class Status extends ImmutablePureComponent { |
|
|
|
|
|
|
|
|
|
state = { |
|
|
|
|
fullscreen: false, |
|
|
|
|
showMedia: !this.props.status ? undefined : (displayMedia !== 'hide_all' && !this.props.status.get('sensitive') || displayMedia === 'show_all'), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
componentWillMount () { |
|
|
|
@ -146,6 +147,13 @@ class Status extends ImmutablePureComponent { |
|
|
|
|
this._scrolledIntoView = false; |
|
|
|
|
this.props.dispatch(fetchStatus(nextProps.params.statusId)); |
|
|
|
|
} |
|
|
|
|
if (!Immutable.is(nextProps.status, this.props.status) && nextProps.status) { |
|
|
|
|
this.setState({ showMedia: displayMedia !== 'hide_all' && !nextProps.status.get('sensitive') || displayMedia === 'show_all' }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleToggleMediaVisibility = () => { |
|
|
|
|
this.setState({ showMedia: !this.state.showMedia }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleFavouriteClick = (status) => { |
|
|
|
@ -312,6 +320,10 @@ class Status extends ImmutablePureComponent { |
|
|
|
|
this.handleToggleHidden(this.props.status); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleHotkeyToggleSensitive = () => { |
|
|
|
|
this.handleToggleMediaVisibility(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleMoveUp = id => { |
|
|
|
|
const { status, ancestorsIds, descendantsIds } = this.props; |
|
|
|
|
|
|
|
|
@ -432,6 +444,7 @@ class Status extends ImmutablePureComponent { |
|
|
|
|
mention: this.handleHotkeyMention, |
|
|
|
|
openProfile: this.handleHotkeyOpenProfile, |
|
|
|
|
toggleHidden: this.handleHotkeyToggleHidden, |
|
|
|
|
toggleSensitive: this.handleHotkeyToggleSensitive, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
@ -455,6 +468,8 @@ class Status extends ImmutablePureComponent { |
|
|
|
|
onOpenMedia={this.handleOpenMedia} |
|
|
|
|
onToggleHidden={this.handleToggleHidden} |
|
|
|
|
domain={domain} |
|
|
|
|
showMedia={this.state.showMedia} |
|
|
|
|
onToggleMediaVisibility={this.handleToggleMediaVisibility} |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<ActionBar |
|
|
|
|