Skip to content

Commit 2cc8f4e

Browse files
authored
Merge pull request #2220 from Urgau/mcp-third-comment
Customize Zulip message for already seconded major change
2 parents d37bb39 + af71f5a commit 2cc8f4e

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

src/handlers/major_change.rs

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -268,22 +268,37 @@ pub(super) async fn handle_command(
268268
false
269269
};
270270

271-
let zulip_msg = if has_concerns {
272-
format!(
273-
"@*{}*: Proposal [#{}]({}) has been seconded, but there are unresolved concerns preventing approval, use `@{} resolve concern-name` in the GitHub thread to resolve them.",
274-
config.zulip_ping,
275-
issue.number,
276-
event.html_url().unwrap(),
277-
&ctx.username,
278-
)
271+
let already_seconded = issue
272+
.labels()
273+
.iter()
274+
.any(|l| &l.name == &config.second_label);
275+
276+
let zulip_ping = &config.zulip_ping;
277+
let issue_number = issue.number;
278+
let issue_url = &issue.html_url;
279+
let bot_username = &ctx.username;
280+
let waiting_period = config.waiting_period;
281+
282+
let zulip_msg = if already_seconded {
283+
if has_concerns {
284+
format!(
285+
"@*{zulip_ping}*: Proposal [#{issue_number}]({issue_url}) has been seconded again, but there are unresolved concerns preventing approval, use `@{bot_username} resolve concern-name` in the GitHub thread to resolve them.",
286+
)
287+
} else {
288+
format!(
289+
"@*{zulip_ping}*: Proposal [#{issue_number}]({issue_url}) has been seconded again, and will be approved in maximum {waiting_period} days if no objections are raised.",
290+
)
291+
}
279292
} else {
280-
format!(
281-
"@*{}*: Proposal [#{}]({}) has been seconded, and will be approved in {} days if no objections are raised.",
282-
config.zulip_ping,
283-
issue.number,
284-
event.html_url().unwrap(),
285-
config.waiting_period,
286-
)
293+
if has_concerns {
294+
format!(
295+
"@*{zulip_ping}*: Proposal [#{issue_number}]({issue_url}) has been seconded, but there are unresolved concerns preventing approval, use `@{bot_username} resolve concern-name` in the GitHub thread to resolve them.",
296+
)
297+
} else {
298+
format!(
299+
"@*{zulip_ping}*: Proposal [#{issue_number}]({issue_url}) has been seconded, and will be approved in {waiting_period} days if no objections are raised.",
300+
)
301+
}
287302
};
288303

289304
handle(

0 commit comments

Comments
 (0)