Use moderateNotification()

This commit is contained in:
Paul Frazee
2024-02-15 16:40:28 -08:00
parent 4dd2fd03c7
commit 283bb44d73
2 changed files with 2 additions and 21 deletions
+2 -19
View File
@@ -1,14 +1,13 @@
import {
AppBskyNotificationListNotifications,
ModerationOpts,
moderateProfile,
moderateNotification,
AppBskyFeedDefs,
AppBskyFeedPost,
AppBskyFeedRepost,
AppBskyFeedLike,
AppBskyEmbedRecord,
} from '@atproto/api'
import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import chunk from 'lodash.chunk'
import {QueryClient} from '@tanstack/react-query'
import {getAgent} from '../../session'
@@ -88,7 +87,6 @@ export async function fetchPage({
// internal methods
// =
// TODO this should be in the sdk as moderateNotification -prf
function shouldFilterNotif(
notif: AppBskyNotificationListNotifications.Notification,
moderationOpts: ModerationOpts | undefined,
@@ -96,22 +94,7 @@ function shouldFilterNotif(
if (!moderationOpts) {
return false
}
const profile = moderateProfile(notif.author, moderationOpts)
if (profile.ui('profileList').filter || notif.author.viewer?.muted) {
return true
}
if (
notif.type === 'reply' ||
notif.type === 'quote' ||
notif.type === 'mention'
) {
// NOTE: the notification overlaps the post enough for this to work
const post = moderatePost(notif, moderationOpts)
if (post.ui('contentList').filter) {
return true
}
}
return false
return moderateNotification(notif, moderationOpts).ui('contentList').filter
}
function groupNotifications(
-2
View File
@@ -187,8 +187,6 @@ export const DebugModScreen = ({}: NativeStackScreenProps<
return moderatePost(post, modOpts)
}, [post, modOpts])
console.log(post)
return (
<moderationOptsOverrideContext.Provider value={modOpts}>
<ScrollView>