From e0f6d034ce5b85924d31238e0def42edd241d2f5 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 25 Jul 2025 12:23:53 +0100 Subject: feat(list): fix status for pr as patch revision using the recently abstracted `get_status` function --- src/bin/ngit/sub_commands/list.rs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/bin/ngit/sub_commands/list.rs b/src/bin/ngit/sub_commands/list.rs index 95e17f3..1fe5b49 100644 --- a/src/bin/ngit/sub_commands/list.rs +++ b/src/bin/ngit/sub_commands/list.rs @@ -8,7 +8,7 @@ use ngit::{ }, git_events::{ KIND_PULL_REQUEST, KIND_PULL_REQUEST_UPDATE, get_commit_id_from_patch, - get_pr_tip_event_or_most_recent_patch_with_ancestors, status_kinds, tag_value, + get_pr_tip_event_or_most_recent_patch_with_ancestors, get_status, status_kinds, tag_value, }, }; use nostr_sdk::Kind; @@ -80,21 +80,7 @@ pub async fn launch() -> Result<()> { .collect(); for proposal in &proposals { - let status = if let Some(e) = statuses - .iter() - .filter(|e| { - status_kinds().contains(&e.kind) - && e.tags.iter().any(|t| { - t.as_slice().len() > 1 && t.as_slice()[1].eq(&proposal.id.to_string()) - }) - }) - .collect::>() - .first() - { - e.kind - } else { - Kind::GitStatusOpen - }; + let status = get_status(proposal, &repo_ref, &statuses, &proposals); if status.eq(&Kind::GitStatusOpen) { open_proposals.push(proposal); } else if status.eq(&Kind::GitStatusClosed) { -- cgit v1.2.3