Prefer post over quote when finding cached post (#2935)

zio/stable
Hailey 2024-02-19 16:15:42 -08:00 committed by GitHub
parent 2e132a7a01
commit da62a77f05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -391,6 +391,9 @@ export function* findAllPostsInQueryData(
>({ >({
queryKey: ['post-feed'], queryKey: ['post-feed'],
}) })
let foundEmbed: AppBskyFeedDefs.PostView | undefined
for (const [_queryKey, queryData] of queryDatas) { for (const [_queryKey, queryData] of queryDatas) {
if (!queryData?.pages) { if (!queryData?.pages) {
continue continue
@ -402,7 +405,7 @@ export function* findAllPostsInQueryData(
} }
const quotedPost = getEmbeddedPost(item.post.embed) const quotedPost = getEmbeddedPost(item.post.embed)
if (quotedPost?.uri === uri) { if (quotedPost?.uri === uri) {
yield embedViewRecordToPostView(quotedPost) foundEmbed = embedViewRecordToPostView(quotedPost)
} }
if ( if (
AppBskyFeedDefs.isPostView(item.reply?.parent) && AppBskyFeedDefs.isPostView(item.reply?.parent) &&
@ -419,6 +422,10 @@ export function* findAllPostsInQueryData(
} }
} }
} }
if (foundEmbed) {
yield foundEmbed
}
} }
function assertSomePostsPassModeration(feed: AppBskyFeedDefs.FeedViewPost[]) { function assertSomePostsPassModeration(feed: AppBskyFeedDefs.FeedViewPost[]) {