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 {
|
||||
AppBskyEmbedRecord,
|
||||
AppBskyEmbedRecordWithMedia,
|
||||
AppBskyFeedDefs,
|
||||
AppBskyFeedPost,
|
||||
AtUri,
|
||||
@@ -188,6 +190,12 @@ export function useNotificationFeedQuery(opts: {
|
||||
hiddenReplyUris.has(item.subjectUri)
|
||||
return !isHiddenReply
|
||||
})
|
||||
.filter(item => {
|
||||
if (item.type === 'quote' && item.subject) {
|
||||
return !hasDetachedQuoteEmbed(item.subject)
|
||||
}
|
||||
return true
|
||||
})
|
||||
.filter(item => {
|
||||
if (
|
||||
item.type === 'reply' ||
|
||||
@@ -273,6 +281,16 @@ export function useNotificationFeedQuery(opts: {
|
||||
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(
|
||||
queryClient: QueryClient,
|
||||
uri: string,
|
||||
|
||||
Reference in New Issue
Block a user