Skip to content

Commit

Permalink
Skip notifications for ignored users (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
landonturner authored Oct 1, 2024
1 parent 7d41c93 commit a17f7f2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 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,11 @@ impl Messenger {
commits: &[T],
thread_guids: Vec<String>,
) {
if self.is_ignored_user(sender) {
info!("Ignoring message 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 +125,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 a17f7f2

Please sign in to comment.