};
componentWillReceiveProps (nextProps) {
- if (!is(nextProps.media, this.props.media)) {
+ console.log(nextProps.revealed);
+ if (!is(nextProps.media, this.props.media) || nextProps.revealed === true) {
this.setState({ visible: nextProps.revealed === undefined ? (displayMedia !== 'hide_all' && !nextProps.sensitive || displayMedia === 'show_all') : nextProps.revealed });
}
}
onOpenVideo={this.handleOpenVideo}
width={this.props.cachedMediaWidth}
cacheWidth={this.props.cacheMediaWidth}
+ revealed={settings.getIn(['media', 'reveal_behind_cw']) && !!status.get('spoiler_text') ? true : undefined}
/>)}
</Bundle>
);
onOpenMedia={this.props.onOpenMedia}
cacheWidth={this.props.cacheMediaWidth}
defaultWidth={this.props.cachedMediaWidth}
+ revealed={settings.getIn(['media', 'reveal_behind_cw']) && !!status.get('spoiler_text') ? true : undefined}
/>
)}
</Bundle>
>
<FormattedMessage id='settings.inline_preview_cards' defaultMessage='Inline preview cards for external links' />
</LocalSettingsPageItem>
+ <LocalSettingsPageItem
+ settings={settings}
+ item={['media', 'reveal_behind_cw']}
+ id='mastodon-settings--reveal-behind-cw'
+ onChange={onChange}
+ >
+ <FormattedMessage id='settings.media_reveal_behind_cw' defaultMessage='Reveal sensitive media behind a CW by default' />
+ </LocalSettingsPageItem>
</div>
),
];
preventPlayback={!expanded}
onOpenVideo={this.handleOpenVideo}
autoplay
+ revealed={settings.getIn(['media', 'reveal_behind_cw']) && !!status.get('spoiler_text') ? true : undefined}
/>
);
mediaIcon = 'video-camera';
fullwidth={settings.getIn(['media', 'fullwidth'])}
hidden={!expanded}
onOpenMedia={this.props.onOpenMedia}
+ revealed={settings.getIn(['media', 'reveal_behind_cw']) && !!status.get('spoiler_text') ? true : undefined}
/>
);
mediaIcon = 'picture-o';
revealed: this.props.revealed === undefined ? (displayMedia !== 'hide_all' && !this.props.sensitive || displayMedia === 'show_all') : this.props.revealed,
};
+ componentWillReceiveProps (nextProps) {
+ if (nextProps.revealed === true) {
+ this.setState({ revealed: true });
+ }
+ }
+
// hard coded in components.scss
// any way to get ::before values programatically?
volWidth = 50;
show_action_bar : true,
}),
media : ImmutableMap({
- letterbox : true,
- fullwidth : true,
+ letterbox : true,
+ fullwidth : true,
+ reveal_behind_cw : false,
}),
notifications : ImmutableMap({
favicon_badge : false,