From 83b3b0e4169795989557aa9e4fd7736d1972023d Mon Sep 17 00:00:00 2001 From: Alejandro Date: Mon, 19 Jan 2026 21:43:22 +0100 Subject: [PATCH] fix: remove redundant reply preview for NIP-10 root replies (#163) * fix: remove redundant reply preview for NIP-10 root replies In NIP-10 thread chats, messages replying directly to the thread root no longer show a reply preview, since replying to the root is implicit in the thread chat context. Reply previews are still shown for replies to other messages within the thread, maintaining proper conversation threading. Changes: - Modified eventToMessage() in nip-10-adapter.ts to only set replyTo when a message has a NIP-10 "reply" marker (replying to another message) - Messages with only a "root" marker now have replyTo=undefined - Prefixed unused rootEventId parameter with underscore to fix lint warning * fix: hide reply button and menu for NIP-10 root message In NIP-10 thread chats, the root message now cannot be replied to directly, as all messages in the thread are implicitly replies to the root. Changes: - Added isRootMessage prop to MessageItem component - Hide reply button when message is the root message - Remove reply option from context menu for root message - Root message check: protocol === "nip-10" && message ID matches rootEventId * revert: restore reply preview logic in NIP-10 adapter Reverted changes to eventToMessage() that removed reply previews for root replies. The UI-level hiding of reply interactions on the root message is sufficient - reply previews can still be shown for consistency with other messages. Changes: - Restored rootEventId parameter (removed underscore prefix) - Restored full reply detection logic (reply, root, or fallback) - Reply previews now shown for all replies including root replies * chore: remove tsconfig.node.tsbuildinfo from repository This build artifact is already gitignored (*.tsbuildinfo) but was previously committed. Removing it from the repository as it should not be tracked in version control. --------- Co-authored-by: Claude --- src/components/ChatViewer.tsx | 16 ++++++++++++++-- tsconfig.node.tsbuildinfo | 1 - 2 files changed, 14 insertions(+), 3 deletions(-) delete mode 100644 tsconfig.node.tsbuildinfo diff --git a/src/components/ChatViewer.tsx b/src/components/ChatViewer.tsx index b62d872..af29920 100644 --- a/src/components/ChatViewer.tsx +++ b/src/components/ChatViewer.tsx @@ -262,6 +262,7 @@ const MessageItem = memo(function MessageItem({ onReply, canReply, onScrollToMessage, + isRootMessage, }: { message: Message; adapter: ChatProtocolAdapter; @@ -269,6 +270,7 @@ const MessageItem = memo(function MessageItem({ onReply?: (messageId: string) => void; canReply: boolean; onScrollToMessage?: (messageId: string) => void; + isRootMessage?: boolean; }) { // Get relays for this conversation (memoized to prevent unnecessary re-subscriptions) const relays = useMemo( @@ -377,7 +379,7 @@ const MessageItem = memo(function MessageItem({ {/* Reactions display - inline after timestamp */} - {canReply && onReply && ( + {canReply && onReply && !isRootMessage && (