Working optimistic reply insertions, preference for OP

This commit is contained in:
Eric Bailey
2025-05-20 15:43:13 -05:00
parent 8bab738fed
commit f8d5ad88c5
3 changed files with 56 additions and 105 deletions
+16
View File
@@ -1,7 +1,10 @@
import {
APP_BSKY_UNSPECCED,
type AppBskyFeedDefs,
AppBskyFeedPost,
AppBskyFeedThreadgate,
type AppBskyUnspeccedGetPostThreadV2,
AtUri,
} from '@atproto/api'
import {type PostThreadParams} from '#/state/queries/usePostThread/types'
@@ -32,3 +35,16 @@ export function getThreadgateRecord(
? view?.record
: undefined
}
export function getRootPostAtUri(post: AppBskyFeedDefs.PostView) {
if (
bsky.dangerousIsType<AppBskyFeedPost.Record>(
post.record,
AppBskyFeedPost.isRecord,
)
) {
if (post.record.reply?.root?.uri) {
return new AtUri(post.record.reply.root.uri)
}
}
}