diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-20 10:25:22 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-20 10:25:22 +0000 |
| commit | 97de61aef110414bad8a1a3f8506e9c1efb37402 (patch) | |
| tree | eee50aff78624b30ff9960d181df5adefdd29ea8 /src/bin/git_remote_nostr/utils.rs | |
| parent | 4bab25d575fa82785a424038e517b09e9485bad3 (diff) | |
feat(remote): include draft PRs
show draft as well as open PRs as remote branches
Diffstat (limited to 'src/bin/git_remote_nostr/utils.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/utils.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs index 316fedb..5048ce2 100644 --- a/src/bin/git_remote_nostr/utils.rs +++ b/src/bin/git_remote_nostr/utils.rs | |||
| @@ -94,7 +94,7 @@ pub fn read_line<'a>(stdin: &io::Stdin, line: &'a mut String) -> io::Result<Vec< | |||
| 94 | Ok(tokens) | 94 | Ok(tokens) |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | pub async fn get_open_proposals( | 97 | pub async fn get_open_or_draft_proposals( |
| 98 | git_repo: &Repo, | 98 | git_repo: &Repo, |
| 99 | repo_ref: &RepoRef, | 99 | repo_ref: &RepoRef, |
| 100 | ) -> Result<HashMap<EventId, (Event, Vec<Event>)>> { | 100 | ) -> Result<HashMap<EventId, (Event, Vec<Event>)>> { |
| @@ -118,7 +118,7 @@ pub async fn get_open_proposals( | |||
| 118 | statuses.reverse(); | 118 | statuses.reverse(); |
| 119 | statuses | 119 | statuses |
| 120 | }; | 120 | }; |
| 121 | let mut open_proposals = HashMap::new(); | 121 | let mut open_or_draft_proposals = HashMap::new(); |
| 122 | 122 | ||
| 123 | for proposal in proposals { | 123 | for proposal in proposals { |
| 124 | let status = if let Some(e) = statuses | 124 | let status = if let Some(e) = statuses |
| @@ -136,7 +136,7 @@ pub async fn get_open_proposals( | |||
| 136 | } else { | 136 | } else { |
| 137 | Kind::GitStatusOpen | 137 | Kind::GitStatusOpen |
| 138 | }; | 138 | }; |
| 139 | if status.eq(&Kind::GitStatusOpen) { | 139 | if [Kind::GitStatusOpen, Kind::GitStatusDraft].contains(&status) { |
| 140 | if let Ok(commits_events) = | 140 | if let Ok(commits_events) = |
| 141 | get_all_proposal_patch_events_from_cache(git_repo_path, repo_ref, &proposal.id) | 141 | get_all_proposal_patch_events_from_cache(git_repo_path, repo_ref, &proposal.id) |
| 142 | .await | 142 | .await |
| @@ -144,13 +144,13 @@ pub async fn get_open_proposals( | |||
| 144 | if let Ok(most_recent_proposal_patch_chain) = | 144 | if let Ok(most_recent_proposal_patch_chain) = |
| 145 | get_most_recent_patch_with_ancestors(commits_events.clone()) | 145 | get_most_recent_patch_with_ancestors(commits_events.clone()) |
| 146 | { | 146 | { |
| 147 | open_proposals | 147 | open_or_draft_proposals |
| 148 | .insert(proposal.id, (proposal, most_recent_proposal_patch_chain)); | 148 | .insert(proposal.id, (proposal, most_recent_proposal_patch_chain)); |
| 149 | } | 149 | } |
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | } | 152 | } |
| 153 | Ok(open_proposals) | 153 | Ok(open_or_draft_proposals) |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | pub async fn get_all_proposals( | 156 | pub async fn get_all_proposals( |