From 32b28d666229ac24cf7b1ac328d1566fb089e1a1 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 3 Feb 2025 14:37:24 -0800 Subject: Fix convo header loading state (#7603) * get initial convo state from cache * undo useConvoQuery changes * fix shadowing situation with new hook --- src/components/dms/MessagesListBlockedFooter.tsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/components/dms/MessagesListBlockedFooter.tsx') diff --git a/src/components/dms/MessagesListBlockedFooter.tsx b/src/components/dms/MessagesListBlockedFooter.tsx index ec7ba2855..19a7cc9c2 100644 --- a/src/components/dms/MessagesListBlockedFooter.tsx +++ b/src/components/dms/MessagesListBlockedFooter.tsx @@ -1,6 +1,6 @@ import React from 'react' import {View} from 'react-native' -import {AppBskyActorDefs, ModerationCause} from '@atproto/api' +import {AppBskyActorDefs, ModerationDecision} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -19,15 +19,12 @@ export function MessagesListBlockedFooter({ recipient: initialRecipient, convoId, hasMessages, - blockInfo, + moderation, }: { recipient: AppBskyActorDefs.ProfileViewBasic convoId: string hasMessages: boolean - blockInfo: { - listBlocks: ModerationCause[] - userBlock: ModerationCause | undefined - } + moderation: ModerationDecision }) { const t = useTheme() const {gtMobile} = useBreakpoints() @@ -39,7 +36,17 @@ export function MessagesListBlockedFooter({ const reportControl = useDialogControl() const blockedByListControl = useDialogControl() - const {listBlocks, userBlock} = blockInfo + const {listBlocks, userBlock} = React.useMemo(() => { + const modui = moderation.ui('profileView') + const blocks = modui.alerts.filter(alert => alert.type === 'blocking') + const listBlocks = blocks.filter(alert => alert.source.type === 'list') + const userBlock = blocks.find(alert => alert.source.type === 'user') + return { + listBlocks, + userBlock, + } + }, [moderation]) + const isBlocking = !!userBlock || !!listBlocks.length const onUnblockPress = React.useCallback(() => { -- cgit 1.4.1