Filter out notifications for detached quote posts
When a user detaches a quote from their post, the corresponding quote notification is now filtered out of the notifications feed. This checks the subject post's embed for a detached record view (both plain record embeds and record-with-media embeds). https://claude.ai/code/session_01PmDHPopw2eEkzznxHuDu3N
This commit is contained in:
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
import {useCallback, useEffect, useMemo, useRef} from 'react'
|
import {useCallback, useEffect, useMemo, useRef} from 'react'
|
||||||
import {
|
import {
|
||||||
|
AppBskyEmbedRecord,
|
||||||
|
AppBskyEmbedRecordWithMedia,
|
||||||
AppBskyFeedDefs,
|
AppBskyFeedDefs,
|
||||||
AppBskyFeedPost,
|
AppBskyFeedPost,
|
||||||
AtUri,
|
AtUri,
|
||||||
@@ -188,6 +190,12 @@ export function useNotificationFeedQuery(opts: {
|
|||||||
hiddenReplyUris.has(item.subjectUri)
|
hiddenReplyUris.has(item.subjectUri)
|
||||||
return !isHiddenReply
|
return !isHiddenReply
|
||||||
})
|
})
|
||||||
|
.filter(item => {
|
||||||
|
if (item.type === 'quote' && item.subject) {
|
||||||
|
return !hasDetachedQuoteEmbed(item.subject)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
.filter(item => {
|
.filter(item => {
|
||||||
if (
|
if (
|
||||||
item.type === 'reply' ||
|
item.type === 'reply' ||
|
||||||
@@ -273,6 +281,16 @@ export function useNotificationFeedQuery(opts: {
|
|||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasDetachedQuoteEmbed(subject: AppBskyFeedDefs.PostView): boolean {
|
||||||
|
if (AppBskyEmbedRecord.isView(subject.embed)) {
|
||||||
|
return AppBskyEmbedRecord.isViewDetached(subject.embed.record)
|
||||||
|
}
|
||||||
|
if (AppBskyEmbedRecordWithMedia.isView(subject.embed)) {
|
||||||
|
return AppBskyEmbedRecord.isViewDetached(subject.embed.record.record)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
export function* findAllPostsInQueryData(
|
export function* findAllPostsInQueryData(
|
||||||
queryClient: QueryClient,
|
queryClient: QueryClient,
|
||||||
uri: string,
|
uri: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user