diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index 8889cb9f67..beaae93949 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -207,12 +207,11 @@ let PostThreadItemLoaded = ({
return makeProfileLink(post.author, 'post', urip.rkey, 'reposted-by')
}, [post.uri, post.author])
const repostsTitle = _(msg`Reposts of this post`)
- const isPostHiddenByThreadgate = threadgateRecord?.hiddenReplies?.includes(
- post.uri,
- )
- // TODO memoize
- const additionalPostAlerts: AppModerationCause[] =
- threadgateRecord && isPostHiddenByThreadgate
+ const additionalPostAlerts: AppModerationCause[] = React.useMemo(() => {
+ const isPostHiddenByThreadgate = threadgateRecord?.hiddenReplies?.includes(
+ post.uri,
+ )
+ return threadgateRecord && isPostHiddenByThreadgate
? [
{
type: 'reply-hidden',
@@ -221,6 +220,7 @@ let PostThreadItemLoaded = ({
},
]
: []
+ }, [post, threadgateRecord])
const translatorUrl = getTranslatorLink(
record?.text || '',
diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx
index 28264a2443..67a20a58b1 100644
--- a/src/view/com/posts/FeedItem.tsx
+++ b/src/view/com/posts/FeedItem.tsx
@@ -22,6 +22,7 @@ import {POST_TOMBSTONE, Shadow, usePostShadow} from '#/state/cache/post-shadow'
import {useFeedFeedbackContext} from '#/state/feed-feedback'
import {useSession} from '#/state/session'
import {useComposerControls} from '#/state/shell/composer'
+import {useThreadgateHiddenReplyUris} from '#/state/threadgate-hidden-replies'
import {isReasonFeedSource, ReasonFeedSource} from 'lib/api/feed/types'
import {MAX_POST_LINES} from 'lib/constants'
import {usePalette} from 'lib/hooks/usePalette'
@@ -34,6 +35,7 @@ import {precacheProfile} from 'state/queries/profile'
import {atoms as a} from '#/alf'
import {Repost_Stroke2_Corner2_Rounded as Repost} from '#/components/icons/Repost'
import {ContentHider} from '#/components/moderation/ContentHider'
+import {AppModerationCause} from '#/components/Pills'
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
import {RichText} from '#/components/RichText'
import {LabelsOnMyPost} from '../../../components/moderation/LabelsOnMe'
@@ -222,6 +224,12 @@ let FeedItemInner = ({
AppBskyFeedDefs.isReasonRepost(reason) &&
reason.by.did === currentAccount?.did
+ const threadgateRecord = AppBskyFeedThreadgate.isRecord(
+ rootPost?.threadgate?.record,
+ )
+ ? rootPost.threadgate.record
+ : undefined
+
return (
{gate('video_debug') && (
@@ -374,11 +384,7 @@ let FeedItemInner = ({
onPressReply={onPressReply}
logContext="FeedItem"
feedContext={feedContext}
- threadgateRecord={
- AppBskyFeedThreadgate.isRecord(rootPost?.threadgate?.record)
- ? rootPost.threadgate.record
- : undefined
- }
+ threadgateRecord={threadgateRecord}
/>
@@ -388,23 +394,50 @@ let FeedItemInner = ({
FeedItemInner = memo(FeedItemInner)
let PostContent = ({
+ post,
moderation,
richText,
postEmbed,
postAuthor,
onOpenEmbed,
+ threadgateRecord,
}: {
moderation: ModerationDecision
richText: RichTextAPI
postEmbed: AppBskyFeedDefs.PostView['embed']
postAuthor: AppBskyFeedDefs.PostView['author']
onOpenEmbed: () => void
+ post: AppBskyFeedDefs.PostView
+ threadgateRecord?: AppBskyFeedThreadgate.Record
}): React.ReactNode => {
const pal = usePalette('default')
const {_} = useLingui()
+ const {currentAccount} = useSession()
const [limitLines, setLimitLines] = useState(
() => countLines(richText.text) >= MAX_POST_LINES,
)
+ const {uris: hiddenReplyUris} = useThreadgateHiddenReplyUris()
+ const additionalPostAlerts: AppModerationCause[] = React.useMemo(() => {
+ const isPostHiddenByHiddenReplyCache = hiddenReplyUris.includes(post.uri)
+ const isPostHiddenByThreadgate =
+ !!threadgateRecord?.hiddenReplies?.includes(post.uri)
+ const isHidden = isPostHiddenByHiddenReplyCache || isPostHiddenByThreadgate
+ const alertSource =
+ threadgateRecord && isPostHiddenByThreadgate
+ ? new AtUri(threadgateRecord.post).host
+ : isPostHiddenByHiddenReplyCache
+ ? currentAccount?.did
+ : undefined
+ return isHidden && alertSource
+ ? [
+ {
+ type: 'reply-hidden',
+ source: {type: 'user', did: alertSource},
+ priority: 6,
+ },
+ ]
+ : []
+ }, [post, hiddenReplyUris, threadgateRecord, currentAccount?.did])
const onPressShowMore = React.useCallback(() => {
setLimitLines(false)
@@ -416,7 +449,11 @@ let PostContent = ({
modui={moderation.ui('contentList')}
ignoreMute
childContainerStyle={styles.contentHiderChild}>
-
+
{richText.text ? (