Skip to content

Commit a17f7f2

Browse files
authored
Skip notifications for ignored users (#389)
1 parent 7d41c93 commit a17f7f2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: ops/src/messenger.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use log::info;
12
use std::collections::BTreeMap;
23
use std::sync::Arc;
34

@@ -108,6 +109,11 @@ impl Messenger {
108109
commits: &[T],
109110
thread_guids: Vec<String>,
110111
) {
112+
if self.is_ignored_user(sender) {
113+
info!("Ignoring message from ignored user: {}", sender.login(),);
114+
return;
115+
}
116+
111117
self.send_to_channel(msg, attachments, repo, branch, commits, thread_guids, false);
112118

113119
participants.add_user(item_owner.clone());
@@ -119,6 +125,13 @@ impl Messenger {
119125
self.send_to_slackbots(participants, repo, msg, attachments);
120126
}
121127

128+
fn is_ignored_user(&self, user: &github::User) -> bool {
129+
self.config
130+
.slack
131+
.ignored_users
132+
.contains(&user.login().to_string())
133+
}
134+
122135
pub fn send_to_owner<T: github::CommitLike>(
123136
&self,
124137
msg: &str,

0 commit comments

Comments
 (0)