Use root post threadgate as source for author feed
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
AppBskyActorDefs,
|
||||
AppBskyFeedDefs,
|
||||
AppBskyFeedPost,
|
||||
AppBskyFeedThreadgate,
|
||||
AtUri,
|
||||
ModerationDecision,
|
||||
RichText as RichTextAPI,
|
||||
@@ -78,7 +79,11 @@ export function FeedItem({
|
||||
isThreadParent,
|
||||
hideTopBorder,
|
||||
isParentBlocked,
|
||||
}: FeedItemProps & {post: AppBskyFeedDefs.PostView}): React.ReactNode {
|
||||
rootPost,
|
||||
}: FeedItemProps & {
|
||||
post: AppBskyFeedDefs.PostView
|
||||
rootPost?: AppBskyFeedDefs.PostView
|
||||
}): React.ReactNode {
|
||||
const postShadowed = usePostShadow(post)
|
||||
const richText = useMemo(
|
||||
() =>
|
||||
@@ -109,6 +114,7 @@ export function FeedItem({
|
||||
isThreadParent={isThreadParent}
|
||||
hideTopBorder={hideTopBorder}
|
||||
isParentBlocked={isParentBlocked}
|
||||
rootPost={rootPost}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -129,9 +135,11 @@ let FeedItemInner = ({
|
||||
isThreadParent,
|
||||
hideTopBorder,
|
||||
isParentBlocked,
|
||||
rootPost,
|
||||
}: FeedItemProps & {
|
||||
richText: RichTextAPI
|
||||
post: Shadow<AppBskyFeedDefs.PostView>
|
||||
rootPost?: AppBskyFeedDefs.PostView
|
||||
}): React.ReactNode => {
|
||||
const queryClient = useQueryClient()
|
||||
const {openComposer} = useComposerControls()
|
||||
@@ -366,6 +374,11 @@ let FeedItemInner = ({
|
||||
onPressReply={onPressReply}
|
||||
logContext="FeedItem"
|
||||
feedContext={feedContext}
|
||||
threadgateRecord={
|
||||
AppBskyFeedThreadgate.isRecord(rootPost?.threadgate?.record)
|
||||
? rootPost.threadgate.record
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -36,6 +36,7 @@ let FeedSlice = ({
|
||||
isThreadChild={isThreadChildAt(slice.items, 0)}
|
||||
hideTopBorder={hideTopBorder}
|
||||
isParentBlocked={slice.items[0].isParentBlocked}
|
||||
rootPost={slice.items[0].post}
|
||||
/>
|
||||
<ViewFullThread uri={slice.items[0].uri} />
|
||||
<FeedItem
|
||||
@@ -53,6 +54,7 @@ let FeedSlice = ({
|
||||
isThreadParent={isThreadParentAt(slice.items, beforeLast)}
|
||||
isThreadChild={isThreadChildAt(slice.items, beforeLast)}
|
||||
isParentBlocked={slice.items[beforeLast].isParentBlocked}
|
||||
rootPost={slice.items[0].post}
|
||||
/>
|
||||
<FeedItem
|
||||
key={slice.items[last]._reactKey}
|
||||
@@ -67,6 +69,7 @@ let FeedSlice = ({
|
||||
isThreadChild={isThreadChildAt(slice.items, last)}
|
||||
isParentBlocked={slice.items[last].isParentBlocked}
|
||||
isThreadLastChild
|
||||
rootPost={slice.items[0].post}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
@@ -91,6 +94,7 @@ let FeedSlice = ({
|
||||
}
|
||||
isParentBlocked={slice.items[i].isParentBlocked}
|
||||
hideTopBorder={hideTopBorder && i === 0}
|
||||
rootPost={slice.items[0].post}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
|
||||
@@ -146,8 +146,8 @@ let PostDropdownBtn = ({
|
||||
const isAuthor = postAuthor.did === currentAccount?.did
|
||||
const isRootPostAuthor = new AtUri(rootUri).host === currentAccount?.did
|
||||
const isReplyHiddenByThreadgate =
|
||||
threadgateRecord?.hiddenReplies?.includes(postUri) ||
|
||||
hiddenReplies.includes(postUri)
|
||||
hiddenReplies.includes(postUri) ||
|
||||
threadgateRecord?.hiddenReplies?.includes(postUri)
|
||||
|
||||
const {mutateAsync: toggleQuoteDetachment, isPending} =
|
||||
useToggleQuoteDetachmentMutation()
|
||||
|
||||
Reference in New Issue
Block a user