[Glitch] Add policy to filter notifications from bots
Port 9c493c20b931474d94e2e8ea8a0ce55925df51eb to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
5c8858acd4
commit
0bd2330164
@ -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;
|
||||
|
||||
@ -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>
|
||||
);
|
||||
|
||||
@ -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 (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user