diff --git a/app/javascript/flavours/glitch/components/media_gallery.jsx b/app/javascript/flavours/glitch/components/media_gallery.jsx index 331ffb2aa1..4abfe55e17 100644 --- a/app/javascript/flavours/glitch/components/media_gallery.jsx +++ b/app/javascript/flavours/glitch/components/media_gallery.jsx @@ -231,6 +231,7 @@ class MediaGallery extends PureComponent { visible: PropTypes.bool, autoplay: PropTypes.bool, onToggleVisibility: PropTypes.func, + matchedFilters: PropTypes.arrayOf(PropTypes.string), }; static defaultProps = { @@ -314,7 +315,7 @@ class MediaGallery extends PureComponent { } render () { - const { media, lang, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props; + const { media, lang, sensitive, letterbox, fullwidth, defaultWidth, autoplay, matchedFilters } = this.props; const { visible } = this.state; const size = media.size; const uncached = media.every(attachment => attachment.get('type') === 'unknown'); @@ -343,7 +344,7 @@ class MediaGallery extends PureComponent {
{children} - {(!visible || uncached) && } + {(!visible || uncached) && } {(visible && !uncached) && (
diff --git a/app/javascript/flavours/glitch/components/spoiler_button.tsx b/app/javascript/flavours/glitch/components/spoiler_button.tsx index 3ba2cbc5fa..bf84ffd04d 100644 --- a/app/javascript/flavours/glitch/components/spoiler_button.tsx +++ b/app/javascript/flavours/glitch/components/spoiler_button.tsx @@ -6,6 +6,7 @@ interface Props { hidden?: boolean; sensitive: boolean; uncached?: boolean; + matchedFilters?: string[]; onClick: React.MouseEventHandler; } @@ -13,6 +14,7 @@ export const SpoilerButton: React.FC = ({ hidden = false, sensitive, uncached = false, + matchedFilters, onClick, }) => { let warning; @@ -28,6 +30,20 @@ export const SpoilerButton: React.FC = ({ action = ( ); + } else if (matchedFilters) { + warning = ( + {chunks}, + }} + /> + ); + action = ( + + ); } else if (sensitive) { warning = ( { return true; } - return (displayMedia !== 'hide_all' && !status.get('sensitive') || displayMedia === 'show_all'); + return !status.get('matched_media_filters') && (displayMedia !== 'hide_all' && !status.get('sensitive') || displayMedia === 'show_all'); }; class Status extends ImmutablePureComponent { @@ -557,6 +557,7 @@ class Status extends ImmutablePureComponent { defaultWidth={this.props.cachedMediaWidth} visible={this.state.showMedia} onToggleVisibility={this.handleToggleMediaVisibility} + matchedFilters={status.get('matched_media_filters')} /> )} , @@ -586,6 +587,7 @@ class Status extends ImmutablePureComponent { blurhash={attachment.get('blurhash')} visible={this.state.showMedia} onToggleVisibility={this.handleToggleMediaVisibility} + matchedFilters={status.get('matched_media_filters')} /> )} , @@ -613,6 +615,7 @@ class Status extends ImmutablePureComponent { deployPictureInPicture={pictureInPicture.get('available') ? this.handleDeployPictureInPicture : undefined} visible={this.state.showMedia} onToggleVisibility={this.handleToggleMediaVisibility} + matchedFilters={status.get('matched_media_filters')} />)} , ); diff --git a/app/javascript/flavours/glitch/features/audio/index.jsx b/app/javascript/flavours/glitch/features/audio/index.jsx index a81156e61e..291d579346 100644 --- a/app/javascript/flavours/glitch/features/audio/index.jsx +++ b/app/javascript/flavours/glitch/features/audio/index.jsx @@ -62,6 +62,7 @@ class Audio extends PureComponent { volume: PropTypes.number, muted: PropTypes.bool, deployPictureInPicture: PropTypes.func, + matchedFilters: PropTypes.arrayOf(PropTypes.string), }; state = { @@ -478,7 +479,7 @@ class Audio extends PureComponent { }; render () { - const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash } = this.props; + const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash, matchedFilters } = this.props; const { paused, volume, currentTime, duration, buffer, dragging, revealed } = this.state; const progress = Math.min((currentTime / duration) * 100, 100); const muted = this.state.muted || volume === 0; @@ -520,7 +521,7 @@ class Audio extends PureComponent { lang={lang} /> -