diff options
author | ふぁぼ原 <ko_kurihara@yahoo.co.jp> | 2018-09-25 12:09:35 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-09-25 05:09:35 +0200 |
commit | f7a6f9489da9b2a1820366654df47b8a52f5c5bc (patch) | |
tree | a0c9017fa701de3e6da02f1b1e3c19671d595fc9 /app/javascript/mastodon/features/video/index.js | |
parent | 4b794e134d427dbc716606324adb9a885a74abec (diff) |
Add a new preference to always hide all media (#8569)
Diffstat (limited to 'app/javascript/mastodon/features/video/index.js')
-rw-r--r-- | app/javascript/mastodon/features/video/index.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/mastodon/features/video/index.js index d17253957..67f7580b9 100644 --- a/app/javascript/mastodon/features/video/index.js +++ b/app/javascript/mastodon/features/video/index.js @@ -5,7 +5,7 @@ import { fromJS } from 'immutable'; import { throttle } from 'lodash'; import classNames from 'classnames'; import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen'; -import { displaySensitiveMedia } from '../../initial_state'; +import { displayMedia } from '../../initial_state'; const messages = defineMessages({ play: { id: 'video.play', defaultMessage: 'Play' }, @@ -111,7 +111,7 @@ class Video extends React.PureComponent { fullscreen: false, hovered: false, muted: false, - revealed: !this.props.sensitive || displaySensitiveMedia, + revealed: displayMedia !== 'hide_all' && !this.props.sensitive || displayMedia === 'show_all', }; setPlayerRef = c => { @@ -272,7 +272,7 @@ class Video extends React.PureComponent { } render () { - const { preview, src, inline, startTime, onOpenVideo, onCloseVideo, intl, alt, detailed } = this.props; + const { preview, src, inline, startTime, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive } = this.props; const { containerWidth, currentTime, duration, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state; const progress = (currentTime / duration) * 100; const playerStyle = {}; @@ -296,6 +296,13 @@ class Video extends React.PureComponent { preload = 'none'; } + let warning; + if (sensitive) { + warning = <FormattedMessage id='status.sensitive_warning' defaultMessage='Sensitive content' />; + } else { + warning = <FormattedMessage id='status.media_hidden' defaultMessage='Media hidden' />; + } + return ( <div role='menuitem' @@ -328,7 +335,7 @@ class Video extends React.PureComponent { /> <button type='button' className={classNames('video-player__spoiler', { active: !revealed })} onClick={this.toggleReveal}> - <span className='video-player__spoiler__title'><FormattedMessage id='status.sensitive_warning' defaultMessage='Sensitive content' /></span> + <span className='video-player__spoiler__title'>{warning}</span> <span className='video-player__spoiler__subtitle'><FormattedMessage id='status.sensitive_toggle' defaultMessage='Click to view' /></span> </button> |