diff options
Diffstat (limited to 'src/view/com/post-thread/PostThreadItem.tsx')
-rw-r--r-- | src/view/com/post-thread/PostThreadItem.tsx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index f2cd8e85a..f2a8be598 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -17,6 +17,7 @@ import {useLanguagePrefs} from '#/state/preferences' import {useOpenLink} from '#/state/preferences/in-app-browser' import {ThreadPost} from '#/state/queries/post-thread' import {useComposerControls} from '#/state/shell/composer' +import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies' import {MAX_POST_LINES} from 'lib/constants' import {usePalette} from 'lib/hooks/usePalette' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' @@ -206,24 +207,22 @@ let PostThreadItemLoaded = ({ return makeProfileLink(post.author, 'post', urip.rkey, 'reposted-by') }, [post.uri, post.author]) const repostsTitle = _(msg`Reposts of this post`) + const threadgateHiddenReplies = useMergedThreadgateHiddenReplies({ + threadgateRecord, + }) const additionalPostAlerts: AppModerationCause[] = React.useMemo(() => { - const isPostHiddenByThreadgate = threadgateRecord?.hiddenReplies?.includes( - post.uri, - ) - const isControlledByViewer = - threadgateRecord && - new AtUri(threadgateRecord.post).host === currentAccount?.did - if (!isControlledByViewer) return [] - return threadgateRecord && isPostHiddenByThreadgate + const isPostHiddenByThreadgate = threadgateHiddenReplies.has(post.uri) + const isControlledByViewer = new AtUri(rootUri).host === currentAccount?.did + return isControlledByViewer && isPostHiddenByThreadgate ? [ { type: 'reply-hidden', - source: {type: 'user', did: new AtUri(threadgateRecord.post).host}, + source: {type: 'user', did: currentAccount?.did}, priority: 6, }, ] : [] - }, [post, threadgateRecord, currentAccount?.did]) + }, [post, currentAccount?.did, threadgateHiddenReplies, rootUri]) const quotesHref = React.useMemo(() => { const urip = new AtUri(post.uri) return makeProfileLink(post.author, 'post', urip.rkey, 'quotes') |