From 10e83a5f55628f6238feaac0df6aeacf5f8d9f5c Mon Sep 17 00:00:00 2001 From: Kieran Date: Sun, 15 Oct 2023 21:40:20 +0100 Subject: [PATCH] Big E tag https://github.com/nostr-protocol/nips/issues/812 --- packages/system/src/event-publisher.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/system/src/event-publisher.ts b/packages/system/src/event-publisher.ts index df5c17a9..7407e74e 100644 --- a/packages/system/src/event-publisher.ts +++ b/packages/system/src/event-publisher.ts @@ -189,13 +189,14 @@ export class EventPublisher { const eb = this.#eb(EventKind.TextNote); eb.content(msg); + const link = NostrLink.fromEvent(replyTo); const thread = EventExt.extractThread(replyTo); if (thread) { const rootOrReplyAsRoot = thread.root || thread.replyTo; if (rootOrReplyAsRoot) { eb.tag([rootOrReplyAsRoot.key, rootOrReplyAsRoot.value ?? "", rootOrReplyAsRoot.relay ?? "", "root"]); } - eb.tag([...(NostrLink.fromEvent(replyTo).toEventTag() ?? []), "reply"]); + eb.tag([...unwrap(link.toEventTag()), "reply"]); eb.tag(["p", replyTo.pubkey]); for (const pk of thread.pubKeys) { @@ -205,12 +206,14 @@ export class EventPublisher { eb.tag(["p", pk]); } } else { - eb.tag([...(NostrLink.fromEvent(replyTo).toEventTag() ?? []), "root"]); + eb.tag([...unwrap(link.toEventTag()), "root"]); // dont tag self in replies if (replyTo.pubkey !== this.#pubKey) { eb.tag(["p", replyTo.pubkey]); } } + // Big E/A tag + eb.tag(unwrap(link.toEventTag()).map((v, i) => (i === 0 ? v.toUpperCase() : v))); eb.processContent(); fnExtra?.(eb); return await this.#sign(eb);