forked from treehouse/mastodon
add local setting to auto reveal media behind cw
parent
1bf035fb67
commit
f534f4869e
|
@ -238,7 +238,8 @@ export default class MediaGallery extends React.PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps (nextProps) {
|
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 });
|
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}
|
onOpenVideo={this.handleOpenVideo}
|
||||||
width={this.props.cachedMediaWidth}
|
width={this.props.cachedMediaWidth}
|
||||||
cacheWidth={this.props.cacheMediaWidth}
|
cacheWidth={this.props.cacheMediaWidth}
|
||||||
|
revealed={settings.getIn(['media', 'reveal_behind_cw']) && !!status.get('spoiler_text') ? true : undefined}
|
||||||
/>)}
|
/>)}
|
||||||
</Bundle>
|
</Bundle>
|
||||||
);
|
);
|
||||||
|
@ -483,6 +484,7 @@ export default class Status extends ImmutablePureComponent {
|
||||||
onOpenMedia={this.props.onOpenMedia}
|
onOpenMedia={this.props.onOpenMedia}
|
||||||
cacheWidth={this.props.cacheMediaWidth}
|
cacheWidth={this.props.cacheMediaWidth}
|
||||||
defaultWidth={this.props.cachedMediaWidth}
|
defaultWidth={this.props.cachedMediaWidth}
|
||||||
|
revealed={settings.getIn(['media', 'reveal_behind_cw']) && !!status.get('spoiler_text') ? true : undefined}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Bundle>
|
</Bundle>
|
||||||
|
|
|
@ -328,6 +328,14 @@ export default class LocalSettingsPage extends React.PureComponent {
|
||||||
>
|
>
|
||||||
<FormattedMessage id='settings.inline_preview_cards' defaultMessage='Inline preview cards for external links' />
|
<FormattedMessage id='settings.inline_preview_cards' defaultMessage='Inline preview cards for external links' />
|
||||||
</LocalSettingsPageItem>
|
</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>
|
</div>
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
|
@ -138,6 +138,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
|
||||||
preventPlayback={!expanded}
|
preventPlayback={!expanded}
|
||||||
onOpenVideo={this.handleOpenVideo}
|
onOpenVideo={this.handleOpenVideo}
|
||||||
autoplay
|
autoplay
|
||||||
|
revealed={settings.getIn(['media', 'reveal_behind_cw']) && !!status.get('spoiler_text') ? true : undefined}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
mediaIcon = 'video-camera';
|
mediaIcon = 'video-camera';
|
||||||
|
@ -151,6 +152,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
|
||||||
fullwidth={settings.getIn(['media', 'fullwidth'])}
|
fullwidth={settings.getIn(['media', 'fullwidth'])}
|
||||||
hidden={!expanded}
|
hidden={!expanded}
|
||||||
onOpenMedia={this.props.onOpenMedia}
|
onOpenMedia={this.props.onOpenMedia}
|
||||||
|
revealed={settings.getIn(['media', 'reveal_behind_cw']) && !!status.get('spoiler_text') ? true : undefined}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
mediaIcon = 'picture-o';
|
mediaIcon = 'picture-o';
|
||||||
|
|
|
@ -119,6 +119,12 @@ export default class Video extends React.PureComponent {
|
||||||
revealed: this.props.revealed === undefined ? (displayMedia !== 'hide_all' && !this.props.sensitive || displayMedia === 'show_all') : this.props.revealed,
|
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
|
// hard coded in components.scss
|
||||||
// any way to get ::before values programatically?
|
// any way to get ::before values programatically?
|
||||||
volWidth = 50;
|
volWidth = 50;
|
||||||
|
|
|
@ -39,8 +39,9 @@ const initialState = ImmutableMap({
|
||||||
show_action_bar : true,
|
show_action_bar : true,
|
||||||
}),
|
}),
|
||||||
media : ImmutableMap({
|
media : ImmutableMap({
|
||||||
letterbox : true,
|
letterbox : true,
|
||||||
fullwidth : true,
|
fullwidth : true,
|
||||||
|
reveal_behind_cw : false,
|
||||||
}),
|
}),
|
||||||
notifications : ImmutableMap({
|
notifications : ImmutableMap({
|
||||||
favicon_badge : false,
|
favicon_badge : false,
|
||||||
|
|
Loading…
Reference in New Issue