mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-11-09 22:09:06 -05:00
Merge pull request #1221 from vitorpamplona/fix-reactions
Changes reactions to not include the entire thread as e-tags.
This commit is contained in:
commit
8073c848a3
17
25.md
17
25.md
|
@ -25,14 +25,16 @@ consider it a "+".
|
||||||
Tags
|
Tags
|
||||||
----
|
----
|
||||||
|
|
||||||
The reaction event SHOULD include `e` and `p` tags from the note the user is
|
The reaction event SHOULD include `a`, `e` and `p` tags pointing to the note the user is
|
||||||
reacting to. This allows users to be notified of reactions to posts they were
|
reacting to. The `p` tag allows authors to be notified. The `e` tags enables clients
|
||||||
mentioned in. Including the `e` tags enables clients to pull all the reactions
|
to pull all the reactions to individual events and `a` tags enables clients to seek reactions
|
||||||
associated with individual posts or all the posts in a thread.
|
for all versions of a replaceable event.
|
||||||
|
|
||||||
The last `e` tag MUST be the `id` of the note that is being reacted to.
|
The `e` tag MUST be the `id` of the note that is being reacted to.
|
||||||
|
|
||||||
The last `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 `p` tag MUST be the `pubkey` of the event being reacted to.
|
||||||
|
|
||||||
The reaction event MAY include a `k` tag with the stringified kind number
|
The reaction event MAY include a `k` tag with the stringified kind number
|
||||||
of the reacted event as its value.
|
of the reacted event as its value.
|
||||||
|
@ -41,9 +43,6 @@ Example code
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent {
|
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(["e", liked.id])
|
||||||
tags.append(["p", liked.pubkey])
|
tags.append(["p", liked.pubkey])
|
||||||
tags.append(["k", liked.kind])
|
tags.append(["k", liked.kind])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user