feat: k tag in reaction and repost

This commit is contained in:
Shusui MOYATANI
2023-12-20 02:24:08 +09:00
parent 0f150d6353
commit 0eb7a554b4
2 changed files with 10 additions and 1 deletions

View File

@@ -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);

View File

@@ -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<Promise<void>[]> => {
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<Promise<void>[]> => {
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: '',
};