Add new filter action to blur media (#34256)

This commit is contained in:
Claire 2025-03-26 08:31:05 +01:00 committed by GitHub
commit c93b2c6809
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 46 additions and 11 deletions

View file

@ -6,6 +6,7 @@ interface Props {
hidden?: boolean;
sensitive: boolean;
uncached?: boolean;
matchedFilters?: string[];
onClick: React.MouseEventHandler<HTMLButtonElement>;
}
@ -13,6 +14,7 @@ export const SpoilerButton: React.FC<Props> = ({
hidden = false,
sensitive,
uncached = false,
matchedFilters,
onClick,
}) => {
let warning;
@ -28,6 +30,20 @@ export const SpoilerButton: React.FC<Props> = ({
action = (
<FormattedMessage id='status.media.open' defaultMessage='Click to open' />
);
} else if (matchedFilters) {
warning = (
<FormattedMessage
id='filter_warning.matches_filter'
defaultMessage='Matches filter “<span>{title}</span>”'
values={{
title: matchedFilters.join(', '),
span: (chunks) => <span className='filter-name'>{chunks}</span>,
}}
/>
);
action = (
<FormattedMessage id='status.media.show' defaultMessage='Click to show' />
);
} else if (sensitive) {
warning = (
<FormattedMessage