Add policy to filter notifications from bots (#38494) (#38809)

This commit is contained in:
Evan Prodromou
2026-06-09 08:28:53 -04:00
committed by GitHub
parent 4fcb28e081
commit 9c493c20b9
16 changed files with 229 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ export interface NotificationPolicyJSON {
for_new_accounts: NotificationPolicyValue;
for_private_mentions: NotificationPolicyValue;
for_limited_accounts: NotificationPolicyValue;
for_bots: NotificationPolicyValue;
summary: {
pending_requests_count: number;
pending_notifications_count: number;

View File

@@ -88,6 +88,13 @@ export const PolicyControls: React.FC = () => {
[dispatch],
);
const handleFilterBots = useCallback(
(value: string) => {
changeFilter(dispatch, 'for_bots', value);
},
[dispatch],
);
if (!notificationPolicy) return null;
const options = [
@@ -209,6 +216,24 @@ export const PolicyControls: React.FC = () => {
/>
}
/>
<SelectWithLabel
value={notificationPolicy.for_bots}
onChange={handleFilterBots}
options={options}
label={
<FormattedMessage
id='notifications.policy.filter_bots_title'
defaultMessage='Bots'
/>
}
hint={
<FormattedMessage
id='notifications.policy.filter_bots_hint'
defaultMessage='Accounts marked as automated'
/>
}
/>
</div>
</section>
);

View File

@@ -48,6 +48,9 @@ export const IgnoreNotificationsModal = ({ filterType }) => {
case 'for_limited_accounts':
title = <FormattedMessage id='ignore_notifications_modal.limited_accounts_title' defaultMessage='Ignore notifications from moderated accounts?' />;
break;
case 'for_bots':
title = <FormattedMessage id='ignore_notifications_modal.bots_title' defaultMessage='Ignore notifications from bots?' />;
break;
}
return (

View File

@@ -780,6 +780,7 @@
"home.pending_critical_update.link": "See updates",
"home.pending_critical_update.title": "Critical security update available!",
"home.show_announcements": "Show announcements",
"ignore_notifications_modal.bots_title": "Ignore notifications from bots?",
"ignore_notifications_modal.disclaimer": "Mastodon cannot inform users that you've ignored their notifications. Ignoring notifications will not stop the messages themselves from being sent.",
"ignore_notifications_modal.filter_instead": "Filter instead",
"ignore_notifications_modal.filter_to_act_users": "You'll still be able to accept, reject, or report users",
@@ -1042,6 +1043,8 @@
"notifications.policy.drop": "Ignore",
"notifications.policy.drop_hint": "Send to the void, never to be seen again",
"notifications.policy.filter": "Filter",
"notifications.policy.filter_bots_hint": "Accounts marked as automated",
"notifications.policy.filter_bots_title": "Bots",
"notifications.policy.filter_hint": "Send to filtered notifications inbox",
"notifications.policy.filter_limited_accounts_hint": "Limited by server moderators",
"notifications.policy.filter_limited_accounts_title": "Moderated accounts",