diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-20 10:01:03 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-20 10:17:28 +0000 |
| commit | 4bab25d575fa82785a424038e517b09e9485bad3 (patch) | |
| tree | 32ada7a0b16a5b37a8047d6a5bc47fe12f90943f /src/bin/git_remote_nostr/push.rs | |
| parent | 316f858f223162408cfd52183ef7645828c2f480 (diff) | |
fix(push): find existing proposal
improve reliability of getting current logged in user to assess if
they have submitted a proposal with the same name / branch name
Diffstat (limited to 'src/bin/git_remote_nostr/push.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 922808c..c0085bd 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -26,7 +26,7 @@ use ngit::{ | |||
| 26 | oid_to_shorthand_string, | 26 | oid_to_shorthand_string, |
| 27 | }, | 27 | }, |
| 28 | git_events::{self, event_to_cover_letter, get_event_root}, | 28 | git_events::{self, event_to_cover_letter, get_event_root}, |
| 29 | login::{self, get_curent_user, user::UserRef}, | 29 | login::{self, user::UserRef}, |
| 30 | repo_ref::{self, get_repo_config_from_yaml}, | 30 | repo_ref::{self, get_repo_config_from_yaml}, |
| 31 | repo_state, | 31 | repo_state, |
| 32 | }; | 32 | }; |
| @@ -288,14 +288,15 @@ async fn process_proposal_refspecs( | |||
| 288 | return Ok((events, rejected_proposal_refspecs)); | 288 | return Ok((events, rejected_proposal_refspecs)); |
| 289 | } | 289 | } |
| 290 | let all_proposals = get_all_proposals(git_repo, repo_ref).await?; | 290 | let all_proposals = get_all_proposals(git_repo, repo_ref).await?; |
| 291 | let current_user = get_curent_user(git_repo)?; | 291 | let current_user = &user_ref.public_key; |
| 292 | 292 | ||
| 293 | for refspec in proposal_refspecs { | 293 | for refspec in proposal_refspecs { |
| 294 | let (from, to) = refspec_to_from_to(refspec).unwrap(); | 294 | let (from, to) = refspec_to_from_to(refspec).unwrap(); |
| 295 | let tip_of_pushed_branch = git_repo.get_commit_or_tip_of_reference(from)?; | 295 | let tip_of_pushed_branch = git_repo.get_commit_or_tip_of_reference(from)?; |
| 296 | 296 | ||
| 297 | // this failed to find existing PR from user | ||
| 297 | if let Some((_, (proposal, patches))) = | 298 | if let Some((_, (proposal, patches))) = |
| 298 | find_proposal_and_patches_by_branch_name(to, &all_proposals, current_user.as_ref()) | 299 | find_proposal_and_patches_by_branch_name(to, &all_proposals, Some(current_user)) |
| 299 | { | 300 | { |
| 300 | if [repo_ref.maintainers.clone(), vec![proposal.pubkey]] | 301 | if [repo_ref.maintainers.clone(), vec![proposal.pubkey]] |
| 301 | .concat() | 302 | .concat() |