Filter activity notifs for muted words (#8637)
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
AppBskyGraphStarterpack,
|
AppBskyGraphStarterpack,
|
||||||
type AppBskyNotificationListNotifications,
|
type AppBskyNotificationListNotifications,
|
||||||
type BskyAgent,
|
type BskyAgent,
|
||||||
|
hasMutedWord,
|
||||||
moderateNotification,
|
moderateNotification,
|
||||||
type ModerationOpts,
|
type ModerationOpts,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
@@ -125,6 +126,23 @@ export function shouldFilterNotif(
|
|||||||
if (!moderationOpts) {
|
if (!moderationOpts) {
|
||||||
return false
|
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) {
|
if (notif.author.viewer?.following) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user