diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-25 12:23:53 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-25 16:10:59 +0100 |
| commit | e0f6d034ce5b85924d31238e0def42edd241d2f5 (patch) | |
| tree | da67bfde00d5d62595b8d96205ea0be68c40a57b | |
| parent | 4fc659074ec5ced3cc0727cf1f3e6af082a189cc (diff) | |
feat(list): fix status for pr as patch revision
using the recently abstracted `get_status` function
| -rw-r--r-- | src/bin/ngit/sub_commands/list.rs | 18 |
1 files changed, 2 insertions, 16 deletions
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::{ | |||
| 8 | }, | 8 | }, |
| 9 | git_events::{ | 9 | git_events::{ |
| 10 | KIND_PULL_REQUEST, KIND_PULL_REQUEST_UPDATE, get_commit_id_from_patch, | 10 | KIND_PULL_REQUEST, KIND_PULL_REQUEST_UPDATE, get_commit_id_from_patch, |
| 11 | get_pr_tip_event_or_most_recent_patch_with_ancestors, status_kinds, tag_value, | 11 | get_pr_tip_event_or_most_recent_patch_with_ancestors, get_status, status_kinds, tag_value, |
| 12 | }, | 12 | }, |
| 13 | }; | 13 | }; |
| 14 | use nostr_sdk::Kind; | 14 | use nostr_sdk::Kind; |
| @@ -80,21 +80,7 @@ pub async fn launch() -> Result<()> { | |||
| 80 | .collect(); | 80 | .collect(); |
| 81 | 81 | ||
| 82 | for proposal in &proposals { | 82 | for proposal in &proposals { |
| 83 | let status = if let Some(e) = statuses | 83 | let status = get_status(proposal, &repo_ref, &statuses, &proposals); |
| 84 | .iter() | ||
| 85 | .filter(|e| { | ||
| 86 | status_kinds().contains(&e.kind) | ||
| 87 | && e.tags.iter().any(|t| { | ||
| 88 | t.as_slice().len() > 1 && t.as_slice()[1].eq(&proposal.id.to_string()) | ||
| 89 | }) | ||
| 90 | }) | ||
| 91 | .collect::<Vec<&nostr::Event>>() | ||
| 92 | .first() | ||
| 93 | { | ||
| 94 | e.kind | ||
| 95 | } else { | ||
| 96 | Kind::GitStatusOpen | ||
| 97 | }; | ||
| 98 | if status.eq(&Kind::GitStatusOpen) { | 84 | if status.eq(&Kind::GitStatusOpen) { |
| 99 | open_proposals.push(proposal); | 85 | open_proposals.push(proposal); |
| 100 | } else if status.eq(&Kind::GitStatusClosed) { | 86 | } else if status.eq(&Kind::GitStatusClosed) { |