From 49d8b5a56e9efaef6e2e8aa1e75aed7f1fa21cbb Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 11 Jul 2025 18:49:59 +0300 Subject: [PATCH] Filter activity notifs for muted words (#8637) --- src/state/queries/notifications/util.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/state/queries/notifications/util.ts b/src/state/queries/notifications/util.ts index faccd80872..a47659a842 100644 --- a/src/state/queries/notifications/util.ts +++ b/src/state/queries/notifications/util.ts @@ -7,6 +7,7 @@ import { AppBskyGraphStarterpack, type AppBskyNotificationListNotifications, type BskyAgent, + hasMutedWord, moderateNotification, type ModerationOpts, } from '@atproto/api' @@ -125,6 +126,23 @@ export function shouldFilterNotif( if (!moderationOpts) { return false } + if ( + notif.reason === 'subscribed-post' && + bsky.dangerousIsType( + notif.record, + AppBskyFeedPost.isRecord, + ) && + hasMutedWord({ + mutedWords: moderationOpts.prefs.mutedWords, + text: notif.record.text, + facets: notif.record.facets, + outlineTags: notif.record.tags, + languages: notif.record.langs, + actor: notif.author, + }) + ) { + return true + } if (notif.author.viewer?.following) { return false }