Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reply message profile display #1326

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions components/Chat/Message/message-content-types/message-reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]>;
Expand Down Expand Up @@ -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 (
<VStack
Expand Down Expand Up @@ -151,7 +157,7 @@ const MessageReplyReference = memo(function MessageReplyReference(props: {
}
/>
<Text preset="smaller" color="secondary" inverted={fromMe}>
{readableProfile}
{inboxName}
</Text>
</HStack>
{!!replyMessageReference && (
Expand Down
12 changes: 7 additions & 5 deletions features/conversation/composer/composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { sentryTrackError } from "@utils/sentry";
import { DecodedMessageWithCodecsType } from "@utils/xmtpRN/client";
import {
DecodedMessage,
InboxId,
MessageId,
RemoteAttachmentCodec,
RemoteAttachmentContent,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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"
: "";

Expand Down
Loading