From 71b4c4e1ebb98e4d05bde8351ed7b6943fd8991a Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Tue, 9 Apr 2024 08:26:30 -0500 Subject: [PATCH] fix custom reactions not being wrapped in : --- src/helpers/nostr/reactions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/nostr/reactions.ts b/src/helpers/nostr/reactions.ts index aee5de3a3..dd1472800 100644 --- a/src/helpers/nostr/reactions.ts +++ b/src/helpers/nostr/reactions.ts @@ -28,7 +28,7 @@ export function draftEventReaction(event: NostrEvent, emoji = "+", url?: string) ]; let content = emoji; - if (url && !content.startsWith(":") && content.endsWith(":")) content = ":" + content + ":"; + if (url && !content.startsWith(":") && !content.endsWith(":")) content = ":" + content + ":"; const draft: DraftNostrEvent = { kind: kinds.Reaction, @@ -37,7 +37,7 @@ export function draftEventReaction(event: NostrEvent, emoji = "+", url?: string) created_at: dayjs().unix(), }; - if (url) draft.tags.push(["emoji", emoji, url]); + if (url) draft.tags.push(["emoji", emoji.replaceAll(/(^:|:$)/g, ""), url]); return draft; }