From 0eb7a554b4535e4b8d7439f0fac650cd4ace369d Mon Sep 17 00:00:00 2001 From: Shusui MOYATANI Date: Wed, 20 Dec 2023 02:24:08 +0900 Subject: [PATCH] feat: k tag in reaction and repost --- src/components/Actions.tsx | 3 +++ src/nostr/useCommands.ts | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/Actions.tsx b/src/components/Actions.tsx index 8934f99..6338a8a 100644 --- a/src/components/Actions.tsx +++ b/src/components/Actions.tsx @@ -93,6 +93,7 @@ const ReactionAction = (props: { event: NostrEvent }) => { pubkey: pubkeyNonNull, reactionTypes: reactionTypes ?? { type: 'LikeDislike', content: '+' }, eventId: eventIdNonNull, + kind: props.event.kind, notifyPubkey: props.event.pubkey, }); setReacted(true); @@ -185,6 +186,7 @@ const RepostAction = (props: { event: NostrEvent }) => { relayUrls: config().relayUrls, pubkey: pubkeyNonNull, eventId: eventIdNonNull, + kind: props.event.kind, notifyPubkey: props.event.pubkey, }); setReposted(true); @@ -269,6 +271,7 @@ const EmojiReactions: Component<{ event: NostrEvent }> = (props) => { pubkey: pubkeyNonNull, reactionTypes: reactionTypes ?? { type: 'LikeDislike', content: '+' }, eventId: eventIdNonNull, + kind: props.event.kind, notifyPubkey: props.event.pubkey, }); setReacted(true); diff --git a/src/nostr/useCommands.ts b/src/nostr/useCommands.ts index 3c9d141..b6bfc37 100644 --- a/src/nostr/useCommands.ts +++ b/src/nostr/useCommands.ts @@ -123,18 +123,21 @@ const useCommands = () => { relayUrls, pubkey, eventId, + kind, reactionTypes, notifyPubkey, }: { relayUrls: string[]; pubkey: string; eventId: string; + kind: number; reactionTypes: ReactionTypes; notifyPubkey: string; }): Promise[]> => { const tags = [ ['e', eventId, ''], ['p', notifyPubkey], + ['k', kind.toString()], ]; if (reactionTypes.type === 'CustomEmoji') { @@ -156,20 +159,23 @@ const useCommands = () => { relayUrls, pubkey, eventId, + kind, notifyPubkey, }: { relayUrls: string[]; pubkey: string; eventId: string; + kind: number; notifyPubkey: string; }): Promise[]> => { const preSignedEvent: UnsignedEvent = { - kind: 6 as Kind, + kind: kind === 1 ? Kind.Repost : 16 /* generic repost */, pubkey, created_at: epoch(), tags: [ ['e', eventId, ''], ['p', notifyPubkey], + ['k', kind.toString()], ], content: '', };