From 3ce14b0c6fbc16d8cdb2cd7354ab3834bf6477ad Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Tue, 12 Aug 2025 02:56:46 +0300
Subject: filter out muted/blocked convos from share menu (#8802)

---
 src/components/PostControls/ShareMenu/RecentChats.tsx | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

(limited to 'src/components/PostControls/ShareMenu/RecentChats.tsx')

diff --git a/src/components/PostControls/ShareMenu/RecentChats.tsx b/src/components/PostControls/ShareMenu/RecentChats.tsx
index ca5d0029e..4b94e0df9 100644
--- a/src/components/PostControls/ShareMenu/RecentChats.tsx
+++ b/src/components/PostControls/ShareMenu/RecentChats.tsx
@@ -4,10 +4,12 @@ import {msg, Trans} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 import {useNavigation} from '@react-navigation/native'
 
+import {isBlockedOrBlocking, isMuted} from '#/lib/moderation/blocked-and-muted'
 import {type NavigationProp} from '#/lib/routes/types'
 import {sanitizeDisplayName} from '#/lib/strings/display-names'
 import {sanitizeHandle} from '#/lib/strings/handles'
 import {logger} from '#/logger'
+import {useProfileShadow} from '#/state/cache/profile-shadow'
 import {useModerationOpts} from '#/state/preferences/moderation-opts'
 import {useListConvosQuery} from '#/state/queries/messages/list-conversations'
 import {useSession} from '#/state/session'
@@ -57,7 +59,11 @@ export function RecentChats({postUri}: {postUri: string}) {
               member => member.did !== currentAccount?.did,
             )
 
-            if (!otherMember || otherMember.handle === 'missing.invalid')
+            if (
+              !otherMember ||
+              otherMember.handle === 'missing.invalid' ||
+              convo.muted
+            )
               return null
 
             return (
@@ -87,7 +93,7 @@ export function RecentChats({postUri}: {postUri: string}) {
 const WIDTH = 80
 
 function RecentChatItem({
-  profile,
+  profile: profileUnshadowed,
   onPress,
   moderationOpts,
 }: {
@@ -98,6 +104,8 @@ function RecentChatItem({
   const {_} = useLingui()
   const t = useTheme()
 
+  const profile = useProfileShadow(profileUnshadowed)
+
   const moderation = moderateProfile(profile, moderationOpts)
   const name = sanitizeDisplayName(
     profile.displayName || sanitizeHandle(profile.handle),
@@ -105,6 +113,10 @@ function RecentChatItem({
   )
   const verification = useSimpleVerificationState({profile})
 
+  if (isBlockedOrBlocking(profile) || isMuted(profile)) {
+    return null
+  }
+
   return (
     <Button
       onPress={onPress}
-- 
cgit 1.4.1

