From 5ff442ad1aad5a994336f3feb04f6ff184b5dde7 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 14 Nov 2023 16:39:00 -0600 Subject: [PATCH] Clean up moderation --- src/view/shell/desktop/Search.tsx | 36 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/view/shell/desktop/Search.tsx b/src/view/shell/desktop/Search.tsx index 6653c88eac..115e0f7ae3 100644 --- a/src/view/shell/desktop/Search.tsx +++ b/src/view/shell/desktop/Search.tsx @@ -7,7 +7,11 @@ import { TouchableOpacity, } from 'react-native' import {useNavigation, StackActions} from '@react-navigation/native' -import {AppBskyActorDefs, moderateProfile} from '@atproto/api' +import { + AppBskyActorDefs, + moderateProfile, + ProfileModeration, +} from '@atproto/api' import {observer} from 'mobx-react-lite' import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -28,19 +32,13 @@ import {useModerationOpts} from '#/state/queries/preferences' export function SearchResultCard({ profile, style, + moderation, }: { profile: AppBskyActorDefs.ProfileViewBasic style: ViewStyle + moderation: ProfileModeration }) { const pal = usePalette('default') - const moderationOpts = useModerationOpts() - - if (!moderationOpts) { - // TODO - return null - } - - const moderation = moderateProfile(profile, moderationOpts) return ( ([]) + const moderationOpts = useModerationOpts() const search = useActorSearch() const onChangeText = React.useCallback( @@ -177,16 +176,15 @@ export const DesktopSearch = observer(function DesktopSearch() { {query !== '' && ( - {searchResults.length ? ( - <> - {searchResults.map((item, i) => ( - - ))} - + {searchResults.length && moderationOpts ? ( + searchResults.map((item, i) => ( + + )) ) : (