From a6e0a9c1a3f36d5a67b53c6fbfd54286d336ac11 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Jan 2026 20:12:20 +0000 Subject: [PATCH] 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 --- src/lib/chat/adapters/nip-10-adapter.ts | 12 +++++------- tsconfig.node.tsbuildinfo | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib/chat/adapters/nip-10-adapter.ts b/src/lib/chat/adapters/nip-10-adapter.ts index 07b8959..ffc33b3 100644 --- a/src/lib/chat/adapters/nip-10-adapter.ts +++ b/src/lib/chat/adapters/nip-10-adapter.ts @@ -847,7 +847,7 @@ export class Nip10Adapter extends ChatProtocolAdapter { private eventToMessage( event: NostrEvent, conversationId: string, - rootEventId: string, + _rootEventId: string, ): Message | null { // Handle zap receipts (kind 9735) if (event.kind === 9735) { @@ -867,14 +867,12 @@ export class Nip10Adapter extends ChatProtocolAdapter { let replyTo: string | undefined; if (refs.reply?.e) { - // Replying to another reply + // Replying to another reply - show reply preview replyTo = refs.reply.e.id; - } else if (refs.root?.e) { - // Replying directly to root - replyTo = refs.root.e.id; } else { - // Malformed or legacy reply - assume replying to root - replyTo = rootEventId; + // Replying directly to root or malformed - don't show reply preview + // (replying to root is implied in thread chat context) + replyTo = undefined; } return { diff --git a/tsconfig.node.tsbuildinfo b/tsconfig.node.tsbuildinfo index 5e39d3d..75ea001 100644 --- a/tsconfig.node.tsbuildinfo +++ b/tsconfig.node.tsbuildinfo @@ -1 +1 @@ -{"root":["./vite.config.ts"],"errors":true,"version":"5.9.3"} \ No newline at end of file +{"root":["./vite.config.ts"],"version":"5.6.3"} \ No newline at end of file