add local setting to auto reveal media behind cw

This commit is contained in:
ash lea authored and ThibG committed 2019-03-11 12:14:45 +01:00
1 parent 1bf035fb67
commit f534f4869e
6 files changed
+23 -3

No files matched your search

@@ -238,7 +238,8 @@ export default class MediaGallery extends React.PureComponent {
};
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 });
}
}
@@ -466,6 +466,7 @@ export default class Status extends ImmutablePureComponent {
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>
);
@@ -483,6 +484,7 @@ export default class Status extends ImmutablePureComponent {
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>