commit 13a7ee82d0f97f91ea57d67841995b671425a29d
parent 23138c5e03a365a59c68c3624984c26d3d147e47
Author: William Casarin <jb55@jb55.com>
Date: Thu, 9 May 2024 15:17:01 -0700
nip10: be nicer to deprecated nip10
to ease the transition, let's not add more than 2 etags or deprecated
nip10 gets confused
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift
@@ -624,15 +624,18 @@ func nip10_reply_tags(replying_to: NostrEvent, keypair: Keypair) -> [[String]] {
// otherwise use the root tag from the parent's nip10 reply and include the note
// that we are replying to's note id.
- var tags = [
+ let tags = [
["e", nip10.root.note_id.hex(), nip10.root.relay ?? "", "root"],
["e", replying_to.id.hex(), "", "reply"]
]
// we also add the parent's nip10 reply tag as an additional e tag for context
+ /* this is incorrect for deprecated nip 10, let's just not add it for now
if let reply = nip10.reply {
tags.append(["e", reply.note_id.hex(), reply.relay ?? ""])
}
+ */
+
return tags
}
diff --git a/damusTests/NIP10Tests.swift b/damusTests/NIP10Tests.swift
@@ -184,7 +184,7 @@ final class NIP10Tests: XCTestCase {
let replying_to_hex = "a8dc8b74852d7ad114d5d650b2125459c0cba3c1fdcaaf527e03f24082e11ab3"
let pk = Pubkey(hex: "5b0183ab6c3e322bf4d41c6b3aef98562a144847b7499543727c5539a114563e")!
- let last_reply_hex = "1bb940ce0ba0d4a3b2a589355d908498dcd7452f941cf520072218f7e6ede75e"
+ //let last_reply_hex = "1bb940ce0ba0d4a3b2a589355d908498dcd7452f941cf520072218f7e6ede75e"
let note = decode_nostr_event_json(json: note_json)!
let reply = build_post(state: test_damus_state, post: .init(string: "hello"), action: .replying_to(note), uploadedMedias: [], pubkeys: [pk] + note.referenced_pubkeys.map({pk in pk}))
let root_hex = "00152d2945459fb394fed2ea95af879c903c4ec42d96327a739fa27c023f20e0"
@@ -193,7 +193,7 @@ final class NIP10Tests: XCTestCase {
[
["e", root_hex, "wss://nostr.mutinywallet.com/", "root"],
["e", replying_to_hex, "", "reply"],
- ["e", last_reply_hex, "wss://relay.nostrplebs.com"],
+ //["e", last_reply_hex, "wss://relay.nostrplebs.com"],
["p", "5b0183ab6c3e322bf4d41c6b3aef98562a144847b7499543727c5539a114563e"],
["p", "6e75f7972397ca3295e0f4ca0fbc6eb9cc79be85bafdd56bd378220ca8eee74e"],
])