diff options
| author | Oscar Merry <MerryOscar@users.noreply.github.com> | 2024-06-17 13:38:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-17 13:38:45 +0100 |
| commit | 45351b561dcc15b9d3c09b64967a5e30a80ddabe (patch) | |
| tree | e3bb8995aed591b519d042909eddd7d983bbe56e /25.md | |
| parent | 32004283da0f0893d7b697c9a0b1a1f8611e9929 (diff) | |
| parent | c576737ba42772a561c6ebfd9faf0baae6d19b17 (diff) | |
Merge branch 'nostr-protocol:master' into external-content-ids
Diffstat (limited to '25.md')
| -rw-r--r-- | 25.md | 20 |
1 files changed, 9 insertions, 11 deletions
| @@ -25,24 +25,23 @@ consider it a "+". | |||
| 25 | Tags | 25 | Tags |
| 26 | ---- | 26 | ---- |
| 27 | 27 | ||
| 28 | The reaction event SHOULD include `a`, `e` and `p` tags pointing to the note the user is | 28 | 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. |
| 29 | reacting to. The `p` tag allows authors to be notified. The `e` tags enables clients | ||
| 30 | to pull all the reactions to individual events and `a` tags enables clients to seek reactions | ||
| 31 | for all versions of a replaceable event. | ||
| 32 | 29 | ||
| 33 | The `e` tag MUST be the `id` of the note that is being reacted to. | 30 | The last `e` tag MUST be the `id` of the note that is being reacted to. |
| 34 | 31 | ||
| 35 | The `a` tag MUST contain the coordinates (`kind:pubkey:d-tag`) of the replaceable being reacted to. | 32 | The last `p` tag MUST be the `pubkey` of the event being reacted to. |
| 36 | 33 | ||
| 37 | The `p` tag MUST be the `pubkey` of the event being reacted to. | 34 | The `a` tag MUST contain the coordinates (`kind:pubkey:d-tag`) of the replaceable being reacted to. |
| 38 | 35 | ||
| 39 | The reaction event MAY include a `k` tag with the stringified kind number | 36 | The reaction event MAY include a `k` tag with the stringified kind number of the reacted event as its value. |
| 40 | of the reacted event as its value. | ||
| 41 | 37 | ||
| 42 | Example code | 38 | Example code |
| 43 | 39 | ||
| 44 | ```swift | 40 | ```swift |
| 45 | func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { | 41 | func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { |
| 42 | var tags: [[String]] = liked.tags.filter { | ||
| 43 | tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p") | ||
| 44 | } | ||
| 46 | tags.append(["e", liked.id]) | 45 | tags.append(["e", liked.id]) |
| 47 | tags.append(["p", liked.pubkey]) | 46 | tags.append(["p", liked.pubkey]) |
| 48 | tags.append(["k", liked.kind]) | 47 | tags.append(["k", liked.kind]) |
| @@ -67,8 +66,7 @@ content as an emoji if shortcode is specified. | |||
| 67 | "tags": [ | 66 | "tags": [ |
| 68 | ["emoji", "soapbox", "https://gleasonator.com/emoji/Gleasonator/soapbox.png"] | 67 | ["emoji", "soapbox", "https://gleasonator.com/emoji/Gleasonator/soapbox.png"] |
| 69 | ], | 68 | ], |
| 70 | "pubkey": "79c2cae114ea28a981e7559b4fe7854a473521a8d22a66bbab9fa248eb820ff6", | 69 | ...other fields |
| 71 | "created_at": 1682790000 | ||
| 72 | } | 70 | } |
| 73 | ``` | 71 | ``` |
| 74 | 72 | ||