[Glitch] Handle preference to always display sensitive media

Port the UI part of 219b28e172 to glitch-soc
lolsob-rspec
Thibaut Girka 2018-04-14 12:27:14 +02:00
parent 7e7494ca4d
commit 4b1909612a
3 changed files with 5 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import IconButton from './icon_button';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { isIOS } from 'flavours/glitch/util/is_mobile'; import { isIOS } from 'flavours/glitch/util/is_mobile';
import classNames from 'classnames'; import classNames from 'classnames';
import { autoPlayGif } from 'flavours/glitch/util/initial_state'; import { autoPlayGif, displaySensitiveMedia } from 'flavours/glitch/util/initial_state';
const messages = defineMessages({ const messages = defineMessages({
hidden: { hidden: {
@ -208,7 +208,7 @@ export default class MediaGallery extends React.PureComponent {
}; };
state = { state = {
visible: !this.props.sensitive, visible: !this.props.sensitive || displaySensitiveMedia,
}; };
componentWillReceiveProps (nextProps) { componentWillReceiveProps (nextProps) {

View File

@ -4,6 +4,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { throttle } from 'lodash'; import { throttle } from 'lodash';
import classNames from 'classnames'; import classNames from 'classnames';
import { isFullscreen, requestFullscreen, exitFullscreen } from 'flavours/glitch/util/fullscreen'; import { isFullscreen, requestFullscreen, exitFullscreen } from 'flavours/glitch/util/fullscreen';
import { displaySensitiveMedia } from 'flavours/glitch/util/initial_state';
const messages = defineMessages({ const messages = defineMessages({
play: { id: 'video.play', defaultMessage: 'Play' }, play: { id: 'video.play', defaultMessage: 'Play' },
@ -108,7 +109,7 @@ export default class Video extends React.PureComponent {
fullscreen: false, fullscreen: false,
hovered: false, hovered: false,
muted: false, muted: false,
revealed: !this.props.sensitive, revealed: !this.props.sensitive || displaySensitiveMedia,
}; };
setPlayerRef = c => { setPlayerRef = c => {

View File

@ -13,6 +13,7 @@ const getMeta = (prop) => initialState && initialState.meta && initialState.meta
export const reduceMotion = getMeta('reduce_motion'); export const reduceMotion = getMeta('reduce_motion');
export const autoPlayGif = getMeta('auto_play_gif'); export const autoPlayGif = getMeta('auto_play_gif');
export const displaySensitiveMedia = getMeta('display_sensitive_media');
export const unfollowModal = getMeta('unfollow_modal'); export const unfollowModal = getMeta('unfollow_modal');
export const boostModal = getMeta('boost_modal'); export const boostModal = getMeta('boost_modal');
export const favouriteModal = getMeta('favourite_modal'); export const favouriteModal = getMeta('favourite_modal');