upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/lib/git_events.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/git_events.rs')
-rw-r--r--src/lib/git_events.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs
index 8ba5419..5ea630a 100644
--- a/src/lib/git_events.rs
+++ b/src/lib/git_events.rs
@@ -63,6 +63,7 @@ pub fn status_kinds() -> Vec<Kind> {
63 63
64pub const KIND_PULL_REQUEST: Kind = Kind::Custom(1618); 64pub const KIND_PULL_REQUEST: Kind = Kind::Custom(1618);
65pub const KIND_PULL_REQUEST_UPDATE: Kind = Kind::Custom(1619); 65pub const KIND_PULL_REQUEST_UPDATE: Kind = Kind::Custom(1619);
66pub const KIND_USER_GRASP_LIST: Kind = Kind::Custom(10317);
66 67
67pub fn event_is_patch_set_root(event: &Event) -> bool { 68pub fn event_is_patch_set_root(event: &Event) -> bool {
68 event.kind.eq(&Kind::GitPatch) 69 event.kind.eq(&Kind::GitPatch)
@@ -376,11 +377,13 @@ pub fn event_tag_from_nip19_or_hex(
376 } 377 }
377} 378}
378 379
380#[allow(clippy::too_many_arguments)]
379pub fn generate_unsigned_pr_or_update_event( 381pub fn generate_unsigned_pr_or_update_event(
380 git_repo: &Repo, 382 git_repo: &Repo,
381 repo_ref: &RepoRef, 383 repo_ref: &RepoRef,
382 signing_public_key: &PublicKey, 384 signing_public_key: &PublicKey,
383 root_proposal: Option<&Event>, 385 root_proposal: Option<&Event>,
386 title_description_overide: &Option<(String, String)>,
384 commit: &Sha1Hash, 387 commit: &Sha1Hash,
385 clone_url_hint: &[&str], 388 clone_url_hint: &[&str],
386 mentions: &[nostr::Tag], 389 mentions: &[nostr::Tag],
@@ -395,13 +398,17 @@ pub fn generate_unsigned_pr_or_update_event(
395 None 398 None
396 }; 399 };
397 400
398 let title = if let Some(cl) = &root_patch_cover_letter { 401 let title = if let Some((title, _)) = &title_description_overide {
402 title.clone()
403 } else if let Some(cl) = &root_patch_cover_letter {
399 cl.title.clone() 404 cl.title.clone()
400 } else { 405 } else {
401 git_repo.get_commit_message_summary(commit)? 406 git_repo.get_commit_message_summary(commit)?
402 }; 407 };
403 408
404 let description = if let Some(cl) = &root_patch_cover_letter { 409 let description = if let Some((_, description)) = &title_description_overide {
410 description.clone()
411 } else if let Some(cl) = &root_patch_cover_letter {
405 cl.description.clone() 412 cl.description.clone()
406 } else { 413 } else {
407 let mut description = git_repo.get_commit_message(commit)?.trim().to_string(); 414 let mut description = git_repo.get_commit_message(commit)?.trim().to_string();