From 87c2827fac7fc9c922f0577931828d4f19c850c9 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Sat, 1 Jul 2023 07:17:05 +1200 Subject: [PATCH] Fix e-tag label in replies to sub-root deprecated-nip-10-style notes --- src/overlord/mod.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/overlord/mod.rs b/src/overlord/mod.rs index 021323b0..469d8b0a 100644 --- a/src/overlord/mod.rs +++ b/src/overlord/mod.rs @@ -1111,9 +1111,19 @@ impl Overlord { // Add an 'e' tag for the note we are replying to add_event_to_tags(&mut tags, parent_id, "reply").await; } 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"." - add_event_to_tags(&mut tags, parent_id, "root").await; + 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"." + 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