Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mentions: Rename reviewers to "cc" #1628

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub(crate) struct MentionsConfig {
pub(crate) struct MentionsPathConfig {
pub(crate) message: Option<String>,
#[serde(default)]
pub(crate) reviewers: Vec<String>,
pub(crate) cc: Vec<String>,
}

#[derive(PartialEq, Eq, Debug, serde::Deserialize)]
Expand Down
10 changes: 5 additions & 5 deletions src/handlers/mentions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ pub(super) async fn parse_input(
.iter()
// Only mention matching paths.
// Don't mention if the author is in the list.
.filter(|(path, MentionsPathConfig { reviewers, .. })| {
.filter(|(path, MentionsPathConfig { cc, .. })| {
let path = Path::new(path);
file_paths.iter().any(|p| p.starts_with(path))
&& !reviewers.iter().any(|r| r == &event.issue.user.login)
&& !cc.iter().any(|r| r == &event.issue.user.login)
})
.map(|(key, _mention)| key.to_string())
.collect();
Expand All @@ -88,16 +88,16 @@ pub(super) async fn handle_input(
// Avoid duplicate mentions.
continue;
}
let MentionsPathConfig { message, reviewers } = &config.paths[to_mention];
let MentionsPathConfig { message, cc } = &config.paths[to_mention];
if !result.is_empty() {
result.push_str("\n\n");
}
match message {
Some(m) => result.push_str(m),
None => write!(result, "Some changes occurred in {to_mention}").unwrap(),
}
if !reviewers.is_empty() {
write!(result, "\n\ncc {}", reviewers.join(", ")).unwrap();
if !cc.is_empty() {
write!(result, "\n\ncc {}", cc.join(", ")).unwrap();
}
state.data.paths.push(to_mention.to_string());
}
Expand Down