Ensure deletes are coming through

This commit is contained in:
Eric Bailey
2025-05-20 20:50:31 -05:00
parent f8d5ad88c5
commit 7d4ce438ca
4 changed files with 82 additions and 66 deletions
+6 -29
View File
@@ -1,6 +1,5 @@
import {
type $Typed,
type AppBskyEmbedRecord,
type AppBskyFeedDefs,
type AppBskyFeedPost,
type AppBskyUnspeccedGetPostThreadV2,
@@ -9,7 +8,6 @@ import {
} from '@atproto/api'
import {type Slice} from '#/state/queries/usePostThread/types'
import {embedViewRecordToPostView} from '#/state/queries/util'
export function threadPostNoUnauthenticated({
uri,
@@ -84,9 +82,12 @@ export function threadPost({
depth,
value: {
...value,
post: {
...value.post,
record: value.post.record as AppBskyFeedPost.Record,
/*
* Do not spread anything here, load bearing for post shadow strict
* equality checks.
*/
post: value.post as Omit<AppBskyFeedDefs.PostView, 'record'> & {
record: AppBskyFeedPost.Record
},
},
moderation: moderatePost(value.post, moderationOpts),
@@ -123,27 +124,3 @@ export function postViewToThreadPlaceholder(
},
}
}
export function embedViewToThreadPlaceholder(
record: AppBskyEmbedRecord.ViewRecord,
): $Typed<
Omit<AppBskyUnspeccedGetPostThreadV2.ThreadItem, 'value'> & {
value: $Typed<AppBskyUnspeccedGetPostThreadV2.ThreadItemPost>
}
> {
return {
$type: 'app.bsky.unspecced.getPostThreadV2#threadItem',
uri: record.uri,
depth: 0, // reset to 0 for highlighted post
value: {
$type: 'app.bsky.unspecced.getPostThreadV2#threadItemPost',
post: embedViewRecordToPostView(record),
isOPThread: false, // unknown
hasOPLike: false, // unknown
// @ts-expect-error
hasUnhydratedReplies: false, // unknown
// TODO test
hasUnhydratedParents: !!(record.value as AppBskyFeedPost.Record).reply, // unknown
},
}
}