Skip to content

Commit 6ee0af8

Browse files
aDotInTheVoidMark-Simulacrum
authored andcommitted
mentions: Correctly handle empty CC list
Closes #1644
1 parent 18eb605 commit 6ee0af8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/handlers/mentions.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ pub(super) async fn parse_input(
6161
let to_mention: Vec<_> = config
6262
.paths
6363
.iter()
64-
// Only mention matching paths.
65-
// Don't mention if only the author is in the list.
6664
.filter(|(path, MentionsPathConfig { cc, .. })| {
6765
let path = Path::new(path);
68-
file_paths.iter().any(|p| p.starts_with(path))
69-
&& !cc
70-
.iter()
71-
.all(|r| r.trim_start_matches('@') == &event.issue.user.login)
66+
// Only mention matching paths.
67+
let touches_relevant_files = file_paths.iter().any(|p| p.starts_with(path));
68+
// Don't mention if only the author is in the list.
69+
let pings_non_author = match &cc[..] {
70+
[only_cc] => only_cc.trim_start_matches('@') != &event.issue.user.login,
71+
_ => true,
72+
};
73+
touches_relevant_files && pings_non_author
7274
})
7375
.map(|(key, _mention)| key.to_string())
7476
.collect();

0 commit comments

Comments
 (0)