Use moderateNotification()
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -187,8 +187,6 @@ export const DebugModScreen = ({}: NativeStackScreenProps<
|
||||
return moderatePost(post, modOpts)
|
||||
}, [post, modOpts])
|
||||
|
||||
console.log(post)
|
||||
|
||||
return (
|
||||
<moderationOptsOverrideContext.Provider value={modOpts}>
|
||||
<ScrollView>
|
||||
|
||||
Reference in New Issue
Block a user