upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-10-20 14:34:52 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-10-20 14:50:07 +0100
commit165fb4e5ee16fe5444c0dd0264c4a327aef2148d (patch)
tree91d6c9596190a950707a75d6ec53f89f718bf6b0 /src
parent890cf4649fe9b66ecd457acfd1be61d4b8c8d3d0 (diff)
fix: reading NIP-22 style Status events during fetch
also fix the report so that we show nip10 style statuses too
Diffstat (limited to 'src')
-rw-r--r--src/bin/ngit/sub_commands/list.rs7
-rw-r--r--src/lib/client.rs24
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::{
13 }, 13 },
14 repo_ref::{RepoRef, is_grasp_server_in_list}, 14 repo_ref::{RepoRef, is_grasp_server_in_list},
15}; 15};
16use nostr::filter::{Alphabet, SingleLetterTag};
16use nostr_sdk::Kind; 17use nostr_sdk::Kind;
17 18
18use crate::{ 19use crate::{
@@ -59,6 +60,12 @@ pub async fn launch() -> Result<()> {
59 nostr::Filter::default() 60 nostr::Filter::default()
60 .kinds(status_kinds().clone()) 61 .kinds(status_kinds().clone())
61 .events(proposals_and_revisions.iter().map(|e| e.id)), 62 .events(proposals_and_revisions.iter().map(|e| e.id)),
63 nostr::Filter::default()
64 .custom_tags(
65 SingleLetterTag::uppercase(Alphabet::E),
66 proposals_and_revisions.iter().map(|e| e.id),
67 )
68 .kinds(status_kinds().clone()),
62 ], 69 ],
63 ) 70 )
64 .await?; 71 .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
31use mockall::*; 31use mockall::*;
32use nostr::{ 32use nostr::{
33 Event, 33 Event,
34 event::{TagKind, TagStandard, UnsignedEvent}, 34 event::UnsignedEvent,
35 filter::Alphabet, 35 filter::Alphabet,
36 nips::{ 36 nips::{
37 nip01::Coordinate, 37 nip01::Coordinate,
@@ -1575,19 +1575,15 @@ async fn process_fetched_events(
1575 } 1575 }
1576 for event in &events { 1576 for event in &events {
1577 if !request.existing_events.contains(&event.id) 1577 if !request.existing_events.contains(&event.id)
1578 && (!event 1578 && !event.tags.iter().any(|t| {
1579 .tags 1579 t.as_slice().len() > 1
1580 .event_ids() 1580 && (t.as_slice()[0].eq("E") || t.as_slice()[0].eq("e"))
1581 .any(|id| report.proposals.contains(id)) 1581 && if let Ok(id) = EventId::parse(&t.as_slice()[1]) {
1582 || event 1582 report.proposals.contains(&id)
1583 .tags 1583 } else {
1584 .filter_standardized(TagKind::Custom(std::borrow::Cow::Borrowed("E"))) 1584 false
1585 .filter_map(|t| match t { 1585 }
1586 TagStandard::Event { event_id, .. } => Some(event_id), 1586 })
1587 TagStandard::EventReport(event_id, ..) => Some(event_id),
1588 _ => None,
1589 })
1590 .any(|id| report.proposals.contains(id)))
1591 { 1587 {
1592 if (event.kind.eq(&Kind::GitPatch) && !event_is_patch_set_root(event)) 1588 if (event.kind.eq(&Kind::GitPatch) && !event_is_patch_set_root(event))
1593 || event.kind.eq(&KIND_PULL_REQUEST_UPDATE) 1589 || event.kind.eq(&KIND_PULL_REQUEST_UPDATE)