Fix e-tag label in replies to sub-root deprecated-nip-10-style notes

This commit is contained in:
Mike Dilger 2023-07-01 07:17:05 +12:00
parent 758b0c4091
commit 87c2827fac

View File

@ -1111,9 +1111,19 @@ impl Overlord {
// Add an 'e' tag for the note we are replying to // Add an 'e' tag for the note we are replying to
add_event_to_tags(&mut tags, parent_id, "reply").await; add_event_to_tags(&mut tags, parent_id, "reply").await;
} else { } else {
// We are replying to the root. match parent.replies_to() {
None => {
// If the parent doesn't have any e-tags, then it is the root
// NIP-10: "A direct reply to the root of a thread should have a single marked "e" tag of type "root"." // NIP-10: "A direct reply to the root of a thread should have a single marked "e" tag of type "root"."
add_event_to_tags(&mut tags, parent_id, "root").await; add_event_to_tags(&mut tags, parent_id, "root").await;
},
Some((_id, _mayberelay)) => {
// FIXME: we could try to climb up events until we find the root.
// We don't know the root. We are a reply.
add_event_to_tags(&mut tags, parent_id, "reply").await;
}
}
} }
// Possibly propagate a subject tag // Possibly propagate a subject tag