From c4fd7a3aea48b3a44354807f2c73819ae4267321 Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 20 Aug 2024 11:20:24 -0700 Subject: [PATCH 1/2] allow owner to see the list (instead of just delete) --- src/components/moderation/Hider.tsx | 6 +-- src/screens/List/ListHiddenScreen.tsx | 56 +++++++++------------------ 2 files changed, 22 insertions(+), 40 deletions(-) diff --git a/src/components/moderation/Hider.tsx b/src/components/moderation/Hider.tsx index f4dafcf065..b020a6a58c 100644 --- a/src/components/moderation/Hider.tsx +++ b/src/components/moderation/Hider.tsx @@ -23,7 +23,7 @@ type Context = { const Context = React.createContext({} as Context) -export const useScreenHider = () => React.useContext(Context) +export const useHider = () => React.useContext(Context) export function Outer({ modui, @@ -73,11 +73,11 @@ export function Outer({ } export function Content({children}: {children: React.ReactNode}) { - const ctx = useScreenHider() + const ctx = useHider() return ctx.isContentVisible ? children : null } export function Mask({children}: {children: React.ReactNode}) { - const ctx = useScreenHider() + const ctx = useHider() return ctx.isContentVisible ? null : children } diff --git a/src/screens/List/ListHiddenScreen.tsx b/src/screens/List/ListHiddenScreen.tsx index 25089509c7..f2f4b62a3f 100644 --- a/src/screens/List/ListHiddenScreen.tsx +++ b/src/screens/List/ListHiddenScreen.tsx @@ -6,11 +6,8 @@ import {useLingui} from '@lingui/react' import {logger} from '#/logger' import {useGoBack} from 'lib/hooks/useGoBack' -import { - useListBlockMutation, - useListDeleteMutation, - useListMuteMutation, -} from 'state/queries/list' +import {sanitizeHandle} from 'lib/strings/handles' +import {useListBlockMutation, useListMuteMutation} from 'state/queries/list' import { UsePreferencesQueryResponse, useRemoveFeedMutation, @@ -21,6 +18,7 @@ import {CenteredView} from 'view/com/util/Views' import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' import {EyeSlash_Stroke2_Corner0_Rounded as EyeSlash} from '#/components/icons/EyeSlash' +import {useHider} from '#/components/moderation/Hider' import {Text} from '#/components/Typography' export function ListHiddenScreen({ @@ -42,9 +40,10 @@ export function ListHiddenScreen({ const [isProcessing, setIsProcessing] = React.useState(false) const listBlockMutation = useListBlockMutation() const listMuteMutation = useListMuteMutation() - const listDeleteMutation = useListDeleteMutation() const {mutateAsync: removeSavedFeed} = useRemoveFeedMutation() + const {setIsContentVisible} = useHider() + const savedFeedConfig = preferences.savedFeeds.find(f => f.value === list.uri) const onUnsubscribe = async () => { @@ -81,24 +80,6 @@ export function ListHiddenScreen({ setIsProcessing(false) } - const onDeleteList = async () => { - setIsProcessing(true) - try { - await listDeleteMutation.mutateAsync({uri: list.uri}) - Toast.show(_(msg`List deleted`)) - } catch (e) { - logger.error('Failed to delete list from saved feeds', {message: e}) - Toast.show( - _( - msg`There was an issue. Please check your internet connection and try again.`, - ), - ) - } finally { - setIsProcessing(false) - goBack() - } - } - const onRemoveList = async () => { if (!savedFeedConfig) return try { @@ -135,7 +116,7 @@ export function ListHiddenScreen({ /> - List hidden + List has been hidden - {isOwner ? ( - - The list you are trying to view ( - {list.name}) has - been hidden. - - ) : ( - The list you are trying to view has been hidden. - )} + + This list - created by{' '} + + {isOwner + ? _(msg`you`) + : sanitizeHandle(list.creator.handle, '@')} + {' '} + - contains possible violations of Bluesky's community guidelines + in its name or description. + @@ -177,11 +159,11 @@ export function ListHiddenScreen({ variant="solid" color="secondary" size="medium" - label={_(msg`Delete List`)} - onPress={onDeleteList} + label={_(msg`Show list anyway`)} + onPress={() => setIsContentVisible(true)} disabled={isProcessing}> - Delete list + Show anyway ) : null} From 18799e74b9e77077b34ef88a4168b5e7df6c448a Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 20 Aug 2024 11:34:35 -0700 Subject: [PATCH 2/2] one more tweak --- src/screens/List/ListHiddenScreen.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/screens/List/ListHiddenScreen.tsx b/src/screens/List/ListHiddenScreen.tsx index f2f4b62a3f..c93a6cc4e1 100644 --- a/src/screens/List/ListHiddenScreen.tsx +++ b/src/screens/List/ListHiddenScreen.tsx @@ -166,8 +166,7 @@ export function ListHiddenScreen({ Show anyway - ) : null} - {list.viewer?.muted || list.viewer?.blocked ? ( + ) : list.viewer?.muted || list.viewer?.blocked ? (