Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: don't expose post content on no-unauthenticated (#2584)

authored by

Mary and committed by
GitHub
55ad8087 7ca6ba2e

+22 -4
+22 -4
src/view/com/post-thread/PostThread.tsx
··· 36 36 import {useLingui} from '@lingui/react' 37 37 import { 38 38 UsePreferencesQueryResponse, 39 + useModerationOpts, 39 40 usePreferencesQuery, 40 41 } from '#/state/queries/preferences' 41 42 import {useSession} from '#/state/session' 42 43 import {isNative} from '#/platform/detection' 43 44 import {logger} from '#/logger' 45 + import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped' 44 46 45 47 const MAINTAIN_VISIBLE_CONTENT_POSITION = {minIndexForVisible: 2} 46 48 ··· 79 81 data: thread, 80 82 } = usePostThreadQuery(uri) 81 83 const {data: preferences} = usePreferencesQuery() 84 + 82 85 const rootPost = thread?.type === 'post' ? thread.post : undefined 83 86 const rootPostRecord = thread?.type === 'post' ? thread.record : undefined 84 87 88 + const moderationOpts = useModerationOpts() 89 + const isNoPwi = React.useMemo(() => { 90 + const mod = 91 + rootPost && moderationOpts 92 + ? moderatePost(rootPost, moderationOpts) 93 + : undefined 94 + 95 + const cause = mod?.content.cause 96 + 97 + return cause 98 + ? cause.type === 'label' && cause.labelDef.id === '!no-unauthenticated' 99 + : false 100 + }, [rootPost, moderationOpts]) 101 + 85 102 useSetTitle( 86 - rootPost && 87 - `${sanitizeDisplayName( 88 - rootPost.author.displayName || `@${rootPost.author.handle}`, 89 - )}: "${rootPostRecord?.text}"`, 103 + rootPost && !isNoPwi 104 + ? `${sanitizeDisplayName( 105 + rootPost.author.displayName || `@${rootPost.author.handle}`, 106 + )}: "${rootPostRecord!.text}"` 107 + : '', 90 108 ) 91 109 useEffect(() => { 92 110 if (rootPost) {