diff options
| author | Oscar Merry <MerryOscar@users.noreply.github.com> | 2024-05-20 11:12:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-20 11:12:03 +0100 |
| commit | 32004283da0f0893d7b697c9a0b1a1f8611e9929 (patch) | |
| tree | c9d13b72167c51968ee934e0f5af4e4a9419b70b /25.md | |
| parent | d33b223c6afe2be3d197d2cdb4686961a6fb2b29 (diff) | |
| parent | d85c3478137c3a17d7a1bdfce4c3cc9ddf7431e3 (diff) | |
Merge branch 'master' into external-content-ids
Diffstat (limited to '25.md')
| -rw-r--r-- | 25.md | 17 |
1 files changed, 8 insertions, 9 deletions
| @@ -25,14 +25,16 @@ consider it a "+". | |||
| 25 | Tags | 25 | Tags |
| 26 | ---- | 26 | ---- |
| 27 | 27 | ||
| 28 | The reaction event SHOULD include `e` and `p` tags from the note the user is | 28 | The reaction event SHOULD include `a`, `e` and `p` tags pointing to the note the user is |
| 29 | reacting to. This allows users to be notified of reactions to posts they were | 29 | reacting to. The `p` tag allows authors to be notified. The `e` tags enables clients |
| 30 | mentioned in. Including the `e` tags enables clients to pull all the reactions | 30 | to pull all the reactions to individual events and `a` tags enables clients to seek reactions |
| 31 | associated with individual posts or all the posts in a thread. | 31 | for all versions of a replaceable event. |
| 32 | 32 | ||
| 33 | The last `e` tag MUST be the `id` of the note that is being reacted to. | 33 | The `e` tag MUST be the `id` of the note that is being reacted to. |
| 34 | 34 | ||
| 35 | The last `p` tag MUST be the `pubkey` of the event being reacted to. | 35 | The `a` tag MUST contain the coordinates (`kind:pubkey:d-tag`) of the replaceable being reacted to. |
| 36 | |||
| 37 | The `p` tag MUST be the `pubkey` of the event being reacted to. | ||
| 36 | 38 | ||
| 37 | The reaction event MAY include a `k` tag with the stringified kind number | 39 | The reaction event MAY include a `k` tag with the stringified kind number |
| 38 | of the reacted event as its value. | 40 | of the reacted event as its value. |
| @@ -41,9 +43,6 @@ Example code | |||
| 41 | 43 | ||
| 42 | ```swift | 44 | ```swift |
| 43 | func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { | 45 | func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { |
| 44 | var tags: [[String]] = liked.tags.filter { | ||
| 45 | tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p") | ||
| 46 | } | ||
| 47 | tags.append(["e", liked.id]) | 46 | tags.append(["e", liked.id]) |
| 48 | tags.append(["p", liked.pubkey]) | 47 | tags.append(["p", liked.pubkey]) |
| 49 | tags.append(["k", liked.kind]) | 48 | tags.append(["k", liked.kind]) |