Prep threadgate shadow hack (#4970)

Co-authored-by: Hailey <me@haileyok.com>
This commit is contained in:
Eric Bailey 2024-08-21 22:16:03 -05:00 committed by GitHub
parent 61f0be705d
commit d5c78b9183
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 68 additions and 23 deletions

View file

@ -129,17 +129,18 @@ export function PostThread({uri}: {uri: string | undefined}) {
currentAccount &&
rootPostUri &&
currentAccount?.did === new AtUri(rootPostUri).host
const initialThreadgateRecord = rootPost?.threadgate?.record as
| AppBskyFeedThreadgate.Record
| undefined
const {data: threadgateRecord} = useThreadgateRecordQuery({
/**
* If the user is the OP and the root post has a threadgate, we should load
* the threadgate record. Otherwise, fallback to initialData, which is taken
* from the response from `getPostThread`.
*/
enabled: Boolean(isOP && rootPostUri),
enabled: Boolean(isOP && rootPostUri && initialThreadgateRecord),
postUri: rootPostUri,
initialData: rootPost?.threadgate?.record as
| AppBskyFeedThreadgate.Record
| undefined,
initialData: initialThreadgateRecord,
})
const moderationOpts = useModerationOpts()