diff --git a/octobot/src/server/github_handler.rs b/octobot/src/server/github_handler.rs index e33b2e2..d03e74d 100644 --- a/octobot/src/server/github_handler.rs +++ b/octobot/src/server/github_handler.rs @@ -409,15 +409,6 @@ impl GithubEventHandler { if self.action.is_empty() { "" } else { "." }, self.action ); - - if self.is_ignored_user(&self.data.sender) { - info!( - "Ignoring event from ignored user: {}", - self.data.sender.login(), - ); - return Some((StatusCode::OK, "ignored-user".into())); - } - if self.event == "ping" { Some(self.handle_ping()) } else if self.event == "pull_request" { @@ -554,13 +545,6 @@ impl GithubEventHandler { reviewer_names } - fn is_ignored_user(&self, user: &github::User) -> bool { - self.config - .slack - .ignored_users - .contains(&user.login().to_string()) - } - fn handle_ping(&self) -> EventResponse { (StatusCode::OK, "ping".into()) } @@ -838,7 +822,13 @@ impl GithubEventHandler { return; } - if comment.user().login() == self.github_session.bot_name() { + if comment.user().login() == self.github_session.bot_name() + || self + .config + .slack + .ignored_users + .contains(&comment.user().login().to_string()) + { info!( "Ignoring message from bot ({}): {}", comment.user().login(), diff --git a/octobot/tests/github_handler_test.rs b/octobot/tests/github_handler_test.rs index eef1c1f..0b28f9d 100644 --- a/octobot/tests/github_handler_test.rs +++ b/octobot/tests/github_handler_test.rs @@ -708,13 +708,13 @@ async fn test_pull_request_comments_ignore_user() { html_url: "http://the-comment".into(), user: User::new("ignore-me[bot]"), }); - test.handler.data.sender = User::new("ignore-me[bot]"); + test.handler.data.sender = User::new("joe-reviewer"); test.mock_pull_request_commits(); test.slack.expect(vec![]); let resp = test.handler.handle_event().await.unwrap(); - assert_eq!((StatusCode::OK, "ignored-user".into()), resp); + assert_eq!((StatusCode::OK, "pr_review_comment".into()), resp); } #[tokio::test]