about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-07-11 18:49:59 +0300
committerGitHub <noreply@github.com>2025-07-11 08:49:59 -0700
commit0e3124a97e96d7f897a7125374b63a98d053598a (patch)
tree56c6dd2a94a58627a2150372f5a1decfd314cf64
parent8f5a8f37af06775b422d4a53d0f94af71d80c0c2 (diff)
downloadvoidsky-0e3124a97e96d7f897a7125374b63a98d053598a.tar.zst
Filter activity notifs for muted words (#8637)
-rw-r--r--src/state/queries/notifications/util.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/state/queries/notifications/util.ts b/src/state/queries/notifications/util.ts
index faccd8087..a47659a84 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<AppBskyFeedPost.Record>(
+      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
   }