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}
/>
-
+
{(revealed || editable) &&
);
mediaIcons.push('picture-o');
@@ -217,6 +218,7 @@ export const DetailedStatus: React.FC<{
blurhash={attachment.get('blurhash')}
height={150}
onToggleVisibility={onToggleMediaVisibility}
+ matchedFilters={status.get('matched_media_filters')}
/>
);
mediaIcons.push('music');
@@ -242,6 +244,7 @@ export const DetailedStatus: React.FC<{
sensitive={status.get('sensitive')}
visible={showMedia}
onToggleVisibility={onToggleMediaVisibility}
+ matchedFilters={status.get('matched_media_filters')}
letterbox={letterboxMedia}
fullwidth={fullwidthMedia}
preventPlayback={!expanded}
diff --git a/app/javascript/flavours/glitch/features/video/index.jsx b/app/javascript/flavours/glitch/features/video/index.jsx
index 89b34cc76c..06604392fe 100644
--- a/app/javascript/flavours/glitch/features/video/index.jsx
+++ b/app/javascript/flavours/glitch/features/video/index.jsx
@@ -139,6 +139,7 @@ class Video extends PureComponent {
muted: PropTypes.bool,
componentIndex: PropTypes.number,
autoFocus: PropTypes.bool,
+ matchedFilters: PropTypes.arrayOf(PropTypes.string),
};
static defaultProps = {
@@ -542,7 +543,7 @@ class Video extends PureComponent {
}
render () {
- const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, lang, letterbox, fullwidth, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
+ const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, lang, letterbox, fullwidth, detailed, sensitive, editable, blurhash, autoFocus, matchedFilters } = this.props;
const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
const progress = Math.min((currentTime / duration) * 100, 100);
const muted = this.state.muted || volume === 0;
@@ -603,7 +604,7 @@ class Video extends PureComponent {
style={{ ...playerStyle, width: '100%' }}
/>}
-
+
diff --git a/app/javascript/flavours/glitch/selectors/index.js b/app/javascript/flavours/glitch/selectors/index.js
index c4da8a2bba..6bc8121e2c 100644
--- a/app/javascript/flavours/glitch/selectors/index.js
+++ b/app/javascript/flavours/glitch/selectors/index.js
@@ -24,12 +24,19 @@ export const makeGetStatus = () => {
}
let filtered = false;
+ let mediaFiltered = false;
if ((accountReblog || accountBase).get('id') !== me && filters) {
let filterResults = statusReblog?.get('filtered') || statusBase.get('filtered') || ImmutableList();
if (!warnInsteadOfHide && filterResults.some((result) => filters.getIn([result.get('filter'), 'filter_action']) === 'hide')) {
return null;
}
- filterResults = filterResults.filter(result => filters.has(result.get('filter')));
+
+ let mediaFilters = filterResults.filter(result => filters.getIn([result.get('filter'), 'filter_action']) === 'blur');
+ if (!mediaFilters.isEmpty()) {
+ mediaFiltered = mediaFilters.map(result => filters.getIn([result.get('filter'), 'title']));
+ }
+
+ filterResults = filterResults.filter(result => filters.has(result.get('filter')) && filters.getIn([result.get('filter'), 'filter_action']) !== 'blur');
if (!filterResults.isEmpty()) {
filtered = filterResults.map(result => filters.getIn([result.get('filter'), 'title']));
}
@@ -46,6 +53,7 @@ export const makeGetStatus = () => {
map.set('reblog', statusReblog);
map.set('account', accountBase);
map.set('matched_filters', filtered);
+ map.set('matched_media_filters', mediaFiltered);
});
},
);