From 58e94b20ceb59326901415e2bdd678c51fab262b Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 6 Jun 2024 08:57:35 -0300 Subject: [PATCH] Revert "Simplifying reactions" This reverts commit 3834c6b60474a677b53847743212df27710e64ec. see https://github.com/nostrability/nostrability/issues/48 --- 25.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/25.md b/25.md index 698f3fb0..17c203e1 100644 --- a/25.md +++ b/25.md @@ -25,24 +25,23 @@ consider it a "+". Tags ---- -The reaction event SHOULD include `a`, `e` and `p` tags pointing to the note the user is -reacting to. The `p` tag allows authors to be notified. The `e` tags enables clients -to pull all the reactions to individual events and `a` tags enables clients to seek reactions -for all versions of a replaceable event. +The reaction event SHOULD include `e` and `p` tags from the note the user is reacting to (and optionally `a` tags if the target is a replaceable event). This allows users to be notified of reactions to posts they were mentioned in. Including the `e` tags enables clients to pull all the reactions associated with individual posts or all the posts in a thread. `a` tags enables clients to seek reactions for all versions of a replaceable event. -The `e` tag MUST be the `id` of the note that is being reacted to. +The last `e` tag MUST be the `id` of the note that is being reacted to. -The `a` tag MUST contain the coordinates (`kind:pubkey:d-tag`) of the replaceable being reacted to. +The last `p` tag MUST be the `pubkey` of the event being reacted to. -The `p` tag MUST be the `pubkey` of the event being reacted to. +The `a` tag MUST contain the coordinates (`kind:pubkey:d-tag`) of the replaceable being reacted to. -The reaction event MAY include a `k` tag with the stringified kind number -of the reacted event as its value. +The reaction event MAY include a `k` tag with the stringified kind number of the reacted event as its value. Example code ```swift func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { + var tags: [[String]] = liked.tags.filter { + tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p") + } tags.append(["e", liked.id]) tags.append(["p", liked.pubkey]) tags.append(["k", liked.kind])