Use moderateNotification()
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user