Skip to content

Commit

Permalink
add some debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Dec 17, 2023
1 parent c156fe9 commit bf58902
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
13 changes: 6 additions & 7 deletions src/handlers/assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/handlers/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit bf58902

Please sign in to comment.