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>
This commit is contained in:
@@ -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
|
// otherwise use the root tag from the parent's nip10 reply and include the note
|
||||||
// that we are replying to's note id.
|
// that we are replying to's note id.
|
||||||
var tags = [
|
let tags = [
|
||||||
["e", nip10.root.note_id.hex(), nip10.root.relay ?? "", "root"],
|
["e", nip10.root.note_id.hex(), nip10.root.relay ?? "", "root"],
|
||||||
["e", replying_to.id.hex(), "", "reply"]
|
["e", replying_to.id.hex(), "", "reply"]
|
||||||
]
|
]
|
||||||
|
|
||||||
// we also add the parent's nip10 reply tag as an additional e tag for context
|
// 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 {
|
if let reply = nip10.reply {
|
||||||
tags.append(["e", reply.note_id.hex(), reply.relay ?? ""])
|
tags.append(["e", reply.note_id.hex(), reply.relay ?? ""])
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
return tags
|
return tags
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ final class NIP10Tests: XCTestCase {
|
|||||||
|
|
||||||
let replying_to_hex = "a8dc8b74852d7ad114d5d650b2125459c0cba3c1fdcaaf527e03f24082e11ab3"
|
let replying_to_hex = "a8dc8b74852d7ad114d5d650b2125459c0cba3c1fdcaaf527e03f24082e11ab3"
|
||||||
let pk = Pubkey(hex: "5b0183ab6c3e322bf4d41c6b3aef98562a144847b7499543727c5539a114563e")!
|
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 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 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"
|
let root_hex = "00152d2945459fb394fed2ea95af879c903c4ec42d96327a739fa27c023f20e0"
|
||||||
@@ -193,7 +193,7 @@ final class NIP10Tests: XCTestCase {
|
|||||||
[
|
[
|
||||||
["e", root_hex, "wss://nostr.mutinywallet.com/", "root"],
|
["e", root_hex, "wss://nostr.mutinywallet.com/", "root"],
|
||||||
["e", replying_to_hex, "", "reply"],
|
["e", replying_to_hex, "", "reply"],
|
||||||
["e", last_reply_hex, "wss://relay.nostrplebs.com"],
|
//["e", last_reply_hex, "wss://relay.nostrplebs.com"],
|
||||||
["p", "5b0183ab6c3e322bf4d41c6b3aef98562a144847b7499543727c5539a114563e"],
|
["p", "5b0183ab6c3e322bf4d41c6b3aef98562a144847b7499543727c5539a114563e"],
|
||||||
["p", "6e75f7972397ca3295e0f4ca0fbc6eb9cc79be85bafdd56bd378220ca8eee74e"],
|
["p", "6e75f7972397ca3295e0f4ca0fbc6eb9cc79be85bafdd56bd378220ca8eee74e"],
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user