Skip to content

Commit 8cb0744

Browse files
committed
Disable mention in manual check
1 parent 403c789 commit 8cb0744

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ async fn commit_check(
754754
.clone()
755755
};
756756
let result = chat::commit_check(&resources, &repo_resources, &hash).await?;
757-
let reply = commit_check_message(&repo, &hash, &commit_settings, &result);
757+
// do not mention in manual check
758+
let reply = commit_check_message(&repo, &hash, &commit_settings, &result, false);
758759
let mut send = reply_to_msg(&bot, &msg, reply)
759760
.parse_mode(ParseMode::MarkdownV2)
760761
.disable_link_preview(true);

src/message.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ pub fn commit_check_message(
1818
commit: &str,
1919
settings: &CommitSettings,
2020
result: &CommitCheckResult,
21+
mention: bool,
2122
) -> String {
2223
format!(
2324
"{summary}
2425
{details}",
2526
summary = commit_check_message_summary(repo, settings, result),
2627
details = markdown::expandable_blockquote(&commit_check_message_additional(
27-
commit, settings, result
28+
commit, settings, result, mention
2829
)),
2930
)
3031
}
@@ -50,6 +51,7 @@ pub fn commit_check_message_additional(
5051
commit: &str,
5152
settings: &CommitSettings,
5253
result: &CommitCheckResult,
54+
mention: bool,
5355
) -> String {
5456
let remove_conditions: BTreeSet<&String> = result.conditions_of_action(Action::Remove);
5557
let auto_remove_msg = if remove_conditions.is_empty() {
@@ -69,7 +71,11 @@ pub fn commit_check_message_additional(
6971
{auto_remove_msg}
7072
",
7173
commit = markdown::escape(commit),
72-
notify = empty_or_start_new_line(&settings.notify.subscribers_markdown()),
74+
notify = if mention {
75+
empty_or_start_new_line(&settings.notify.subscribers_markdown())
76+
} else {
77+
"".to_string()
78+
},
7379
all = markdown_list(result.all.iter())
7480
)
7581
}

src/update.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ async fn update_chat_repo_commit(
190190
if !suppress_notification_conditions.is_empty() {
191191
log::info!("suppress notification for check result of ({chat}, {repo}): {result:?}",);
192192
} else {
193-
let message = commit_check_message(repo, commit, settings, &result);
193+
// mention in update
194+
let message = commit_check_message(repo, commit, settings, &result, true);
194195
let mut send = bot
195196
.send_message(chat, message)
196197
.parse_mode(ParseMode::MarkdownV2)

0 commit comments

Comments
 (0)