From bf58902754a224b144d37b5c70008e7bb572ec1a Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 16 Dec 2023 21:46:14 -0500 Subject: [PATCH] add some debugging --- src/github.rs | 5 ++++- src/handlers/assign.rs | 13 ++++++------- src/handlers/notification.rs | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/github.rs b/src/github.rs index bbd824dd..bfcbef40 100644 --- a/src/github.rs +++ b/src/github.rs @@ -1859,7 +1859,10 @@ impl Event { pub fn comment_from(&self) -> Option<&str> { match self { Event::Create(_) => None, - Event::Issue(e) => Some(&e.changes.as_ref()?.body.as_ref()?.from), + Event::Issue(e) => { + log::debug!("issue body: {:?}", e.changes); + Some(&e.changes.as_ref()?.body.as_ref()?.from) + } Event::IssueComment(e) => Some(&e.changes.as_ref()?.body.as_ref()?.from), Event::Push(_) => None, } diff --git a/src/handlers/assign.rs b/src/handlers/assign.rs index d6315a5b..98234854 100644 --- a/src/handlers/assign.rs +++ b/src/handlers/assign.rs @@ -475,16 +475,15 @@ pub(super) async fn handle_command( // r? is ignored if `owners` is not configured in triagebot.toml. return Ok(()); } - if matches!( - event, - Event::Issue(IssuesEvent { - action: IssuesAction::Opened | IssuesAction::Edited, - .. - }) - ) { + if let Event::Issue(IssuesEvent { + action: action @ (IssuesAction::Opened | IssuesAction::Edited), + .. + }) = event + { // Don't handle r? comments on new PRs. Those will be // handled by the new PR trigger (which also handles the // welcome message). + log::debug!("not handling PR event {action:?} (delegating to handle_assign)"); return Ok(()); } if is_self_assign(&name, &event.user().login) { diff --git a/src/handlers/notification.rs b/src/handlers/notification.rs index 718b2b24..04749546 100644 --- a/src/handlers/notification.rs +++ b/src/handlers/notification.rs @@ -57,6 +57,7 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> { // comment, so they don't get notified again let mut users_notified = HashSet::new(); if let Some(from) = event.comment_from() { + log::debug!("previous comment text: {from}"); for login in parser::get_mentions(from).into_iter() { if let Some((Ok(users), _)) = id_from_user(ctx, login).await? { users_notified.extend(users.into_iter().map(|user| user.id.unwrap()));