Skip to content

Commit

Permalink
move ignored user check to before notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Landon Turner committed Aug 30, 2024
1 parent 7d41c93 commit aa4202b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ops/src/messenger.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use log::info;
use std::collections::BTreeMap;
use std::sync::Arc;

Expand Down Expand Up @@ -108,6 +109,14 @@ impl Messenger {
commits: &[T],
thread_guids: Vec<String>,
) {
if self.is_ignored_user(sender) {
info!(
"Ignoring event from ignored user: {}",
sender.login(),
);
return;
}

self.send_to_channel(msg, attachments, repo, branch, commits, thread_guids, false);

participants.add_user(item_owner.clone());
Expand All @@ -119,6 +128,13 @@ impl Messenger {
self.send_to_slackbots(participants, repo, msg, attachments);
}

fn is_ignored_user(&self, user: &github::User) -> bool {
self.config
.slack
.ignored_users
.contains(&user.login().to_string())
}

pub fn send_to_owner<T: github::CommitLike>(
&self,
msg: &str,
Expand Down

0 comments on commit aa4202b

Please sign in to comment.