From 165fb4e5ee16fe5444c0dd0264c4a327aef2148d Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 20 Oct 2025 14:34:52 +0100 Subject: fix: reading NIP-22 style Status events during fetch also fix the report so that we show nip10 style statuses too --- src/bin/ngit/sub_commands/list.rs | 7 +++++++ src/lib/client.rs | 24 ++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/bin/ngit/sub_commands/list.rs b/src/bin/ngit/sub_commands/list.rs index 2de3151..981307d 100644 --- a/src/bin/ngit/sub_commands/list.rs +++ b/src/bin/ngit/sub_commands/list.rs @@ -13,6 +13,7 @@ use ngit::{ }, repo_ref::{RepoRef, is_grasp_server_in_list}, }; +use nostr::filter::{Alphabet, SingleLetterTag}; use nostr_sdk::Kind; use crate::{ @@ -59,6 +60,12 @@ pub async fn launch() -> Result<()> { nostr::Filter::default() .kinds(status_kinds().clone()) .events(proposals_and_revisions.iter().map(|e| e.id)), + nostr::Filter::default() + .custom_tags( + SingleLetterTag::uppercase(Alphabet::E), + proposals_and_revisions.iter().map(|e| e.id), + ) + .kinds(status_kinds().clone()), ], ) .await?; diff --git a/src/lib/client.rs b/src/lib/client.rs index 92bf266..c08cd04 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -31,7 +31,7 @@ use indicatif::{MultiProgress, ProgressBar, ProgressDrawTarget, ProgressState, P use mockall::*; use nostr::{ Event, - event::{TagKind, TagStandard, UnsignedEvent}, + event::UnsignedEvent, filter::Alphabet, nips::{ nip01::Coordinate, @@ -1575,19 +1575,15 @@ async fn process_fetched_events( } for event in &events { if !request.existing_events.contains(&event.id) - && (!event - .tags - .event_ids() - .any(|id| report.proposals.contains(id)) - || event - .tags - .filter_standardized(TagKind::Custom(std::borrow::Cow::Borrowed("E"))) - .filter_map(|t| match t { - TagStandard::Event { event_id, .. } => Some(event_id), - TagStandard::EventReport(event_id, ..) => Some(event_id), - _ => None, - }) - .any(|id| report.proposals.contains(id))) + && !event.tags.iter().any(|t| { + t.as_slice().len() > 1 + && (t.as_slice()[0].eq("E") || t.as_slice()[0].eq("e")) + && if let Ok(id) = EventId::parse(&t.as_slice()[1]) { + report.proposals.contains(&id) + } else { + false + } + }) { if (event.kind.eq(&Kind::GitPatch) && !event_is_patch_set_root(event)) || event.kind.eq(&KIND_PULL_REQUEST_UPDATE) -- cgit v1.2.3