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 { import {
AppBskyNotificationListNotifications, AppBskyNotificationListNotifications,
ModerationOpts, ModerationOpts,
moderateProfile, moderateNotification,
AppBskyFeedDefs, AppBskyFeedDefs,
AppBskyFeedPost, AppBskyFeedPost,
AppBskyFeedRepost, AppBskyFeedRepost,
AppBskyFeedLike, AppBskyFeedLike,
AppBskyEmbedRecord, AppBskyEmbedRecord,
} from '@atproto/api' } from '@atproto/api'
import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import chunk from 'lodash.chunk' import chunk from 'lodash.chunk'
import {QueryClient} from '@tanstack/react-query' import {QueryClient} from '@tanstack/react-query'
import {getAgent} from '../../session' import {getAgent} from '../../session'
@@ -88,7 +87,6 @@ export async function fetchPage({
// internal methods // internal methods
// = // =
// TODO this should be in the sdk as moderateNotification -prf
function shouldFilterNotif( function shouldFilterNotif(
notif: AppBskyNotificationListNotifications.Notification, notif: AppBskyNotificationListNotifications.Notification,
moderationOpts: ModerationOpts | undefined, moderationOpts: ModerationOpts | undefined,
@@ -96,22 +94,7 @@ function shouldFilterNotif(
if (!moderationOpts) { if (!moderationOpts) {
return false return false
} }
const profile = moderateProfile(notif.author, moderationOpts) return moderateNotification(notif, moderationOpts).ui('contentList').filter
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
} }
function groupNotifications( function groupNotifications(
-2
View File
@@ -187,8 +187,6 @@ export const DebugModScreen = ({}: NativeStackScreenProps<
return moderatePost(post, modOpts) return moderatePost(post, modOpts)
}, [post, modOpts]) }, [post, modOpts])
console.log(post)
return ( return (
<moderationOptsOverrideContext.Provider value={modOpts}> <moderationOptsOverrideContext.Provider value={modOpts}>
<ScrollView> <ScrollView>