From d4108ff0568ee4e5ac08ec4271ce2b88bb134a24 Mon Sep 17 00:00:00 2001 From: Louis Rouffineau Date: Mon, 9 Dec 2024 16:45:17 +0100 Subject: [PATCH] Fix reply to (#1326) --- .../message-content-types/message-reply.tsx | 16 +++++++++++----- features/conversation/composer/composer.tsx | 12 +++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/components/Chat/Message/message-content-types/message-reply.tsx b/components/Chat/Message/message-content-types/message-reply.tsx index 70108e65f..3ff5c68ce 100644 --- a/components/Chat/Message/message-content-types/message-reply.tsx +++ b/components/Chat/Message/message-content-types/message-reply.tsx @@ -19,9 +19,15 @@ import { useQuery } from "@tanstack/react-query"; import { useAppTheme } from "@theme/useAppTheme"; import { sentryTrackError } from "@utils/sentry"; import { getReadableProfile } from "@utils/str"; -import { DecodedMessage, MessageId, ReplyCodec } from "@xmtp/react-native-sdk"; +import { + DecodedMessage, + InboxId, + MessageId, + ReplyCodec, +} from "@xmtp/react-native-sdk"; import { memo } from "react"; import { getCurrentConversationMessages } from "../../../../features/conversation/conversation-service"; +import { usePreferredInboxName } from "@/hooks/usePreferredInboxName"; export const MessageReply = memo(function MessageReply(props: { message: DecodedMessage<[ReplyCodec]>; @@ -116,9 +122,9 @@ const MessageReplyReference = memo(function MessageReplyReference(props: { const replyMessageReference = useConversationMessageForReplyMessage(referenceMessageId); - const readableProfile = replyMessageReference - ? getReadableProfile(currentAccount, replyMessageReference.senderAddress) - : null; + const inboxName = usePreferredInboxName( + replyMessageReference?.senderAddress as InboxId + ); return ( - {readableProfile} + {inboxName} {!!replyMessageReference && ( diff --git a/features/conversation/composer/composer.tsx b/features/conversation/composer/composer.tsx index bbd2148a5..91f0a75c9 100644 --- a/features/conversation/composer/composer.tsx +++ b/features/conversation/composer/composer.tsx @@ -25,6 +25,7 @@ import { sentryTrackError } from "@utils/sentry"; import { DecodedMessageWithCodecsType } from "@utils/xmtpRN/client"; import { DecodedMessage, + InboxId, MessageId, RemoteAttachmentCodec, RemoteAttachmentContent, @@ -64,6 +65,7 @@ import { } from "../conversation-service"; import { AddAttachmentButton } from "./add-attachment-button"; import { ISendMessageParams } from "@/features/conversation/conversation-context"; +import { usePreferredInboxName } from "@/hooks/usePreferredInboxName"; export type IComposerSendArgs = ISendMessageParams; @@ -230,15 +232,15 @@ const ReplyPreview = memo(function ReplyPreview() { ? getConversationMessages(currentAccount, topic!)?.byId[replyingToMessageId] : undefined; - const readableProfile = replyMessage - ? getReadableProfile(currentAccount, replyMessage?.senderAddress) - : null; + const inboxName = usePreferredInboxName( + replyMessage?.senderAddress as InboxId + ); const replyingTo = replyMessage ? replyMessage.senderAddress === currentAccountInboxId ? `Replying to you` - : readableProfile - ? `Replying to ${readableProfile}` + : inboxName + ? `Replying to ${inboxName}` : "Replying" : "";