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