Include "root" e tag in our replies

This commit is contained in:
Mike Dilger 2023-01-12 02:46:38 +13:00
parent 88da5b8bb9
commit c127a8eecd

View File

@ -722,7 +722,6 @@ impl Overlord {
};
// Get the event we are replying to
/*
let event = match GLOBALS.events.get(&reply_to) {
Some(e) => e,
None => {
@ -731,7 +730,14 @@ impl Overlord {
))
}
};
*/
if let Some((root, _maybeurl)) = event.replies_to_root() {
// Add an 'e' tag for the root
tags.push(Tag::Event {
id: root,
recommended_relay_url: DbRelay::recommended_relay_for_reply(reply_to).await?,
marker: Some("root".to_string()),
});
// Add an 'e' tag for the note we are replying to
tags.push(Tag::Event {
@ -739,6 +745,16 @@ impl Overlord {
recommended_relay_url: DbRelay::recommended_relay_for_reply(reply_to).await?,
marker: Some("reply".to_string()),
});
} else {
// We are replying to the root.
// NIP-10: "A direct reply to the root of a thread should have a single marked "e" tag of type "root"."
tags.push(Tag::Event {
id: reply_to,
recommended_relay_url: DbRelay::recommended_relay_for_reply(reply_to).await?,
marker: Some("root".to_string()),
});
}
/* These are now done in the UI so the poster can refer to them