From 90b70235a62cf6dc788edaf150ffadbefb9dcd9a Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 23 Nov 2024 09:44:46 -0800 Subject: [PATCH] Pluralize merge-conflicts Personal preference, felt better this way. --- src/config.rs | 4 ++-- src/handlers.rs | 8 ++++---- src/handlers/{merge_conflict.rs => merge_conflicts.rs} | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) rename src/handlers/{merge_conflict.rs => merge_conflicts.rs} (98%) diff --git a/src/config.rs b/src/config.rs index 267afc0f..5057baf1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -45,7 +45,7 @@ pub(crate) struct Config { pub(crate) validate_config: Option, pub(crate) pr_tracking: Option, pub(crate) transfer: Option, - pub(crate) merge_conflict: Option, + pub(crate) merge_conflicts: Option, } #[derive(PartialEq, Eq, Debug, serde::Deserialize)] @@ -540,7 +540,7 @@ mod tests { validate_config: Some(ValidateConfig {}), pr_tracking: None, transfer: None, - merge_conflict: None, + merge_conflicts: None, } ); } diff --git a/src/handlers.rs b/src/handlers.rs index 4c8d7f2d..a8157679 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -31,7 +31,7 @@ mod github_releases; mod glacier; mod major_change; mod mentions; -mod merge_conflict; +mod merge_conflicts; mod milestone_prs; mod no_merges; mod nominate; @@ -145,10 +145,10 @@ pub async fn handle(ctx: &Context, event: &Event) -> Vec { } } - if let Some(conflict_config) = config.as_ref().ok().and_then(|c| c.merge_conflict.as_ref()) { - if let Err(e) = merge_conflict::handle(ctx, event, conflict_config).await { + if let Some(conflict_config) = config.as_ref().ok().and_then(|c| c.merge_conflicts.as_ref()) { + if let Err(e) = merge_conflicts::handle(ctx, event, conflict_config).await { log::error!( - "failed to process event {:?} with merge_conflict handler: {:?}", + "failed to process event {:?} with merge_conflicts handler: {:?}", event, e ); diff --git a/src/handlers/merge_conflict.rs b/src/handlers/merge_conflicts.rs similarity index 98% rename from src/handlers/merge_conflict.rs rename to src/handlers/merge_conflicts.rs index 42fc702f..ba4905fc 100644 --- a/src/handlers/merge_conflict.rs +++ b/src/handlers/merge_conflicts.rs @@ -31,7 +31,7 @@ use tokio_postgres::Client as DbClient; use tracing as log; /// Key for the database. -const MERGE_CONFLICT_KEY: &str = "merge-conflict"; +const MERGE_CONFLICTS_KEY: &str = "merge-conflicts"; /// The amount of time to wait before scanning an unknown mergeable status. /// @@ -262,7 +262,7 @@ async fn maybe_add_comment( possibly: Option<&str>, ) -> anyhow::Result<()> { let mut state: IssueData<'_, MergeConflictState> = - IssueData::load(db, issue, MERGE_CONFLICT_KEY).await?; + IssueData::load(db, issue, MERGE_CONFLICTS_KEY).await?; if state.data.last_warned_comment.is_some() { // There was already an unresolved notification, don't warn again. return Ok(()); @@ -308,7 +308,7 @@ async fn maybe_hide_comment( issue: &Issue, ) -> anyhow::Result<()> { let mut state: IssueData<'_, MergeConflictState> = - IssueData::load(db, issue, MERGE_CONFLICT_KEY).await?; + IssueData::load(db, issue, MERGE_CONFLICTS_KEY).await?; let Some(comment_id) = &state.data.last_warned_comment else { return Ok(()); };