Skip to content

Commit c295311

Browse files
authored
Merge pull request #2327 from Kobzol/fix-comment
Fix endless comment loop
2 parents 8c04e72 + 2734ec6 commit c295311

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

site/src/api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ pub mod github {
616616
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
617617
pub struct User {
618618
pub id: u64,
619+
pub login: String,
619620
}
620621

621622
#[derive(Debug, Clone, Serialize, Deserialize)]

site/src/request_handlers/github.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ async fn handle_rust_timer(
9797
comment: github::Comment,
9898
issue: github::Issue,
9999
) -> ServerResult<github::Response> {
100+
// Avoid reacting to the bot's comments
101+
if comment.user.login == "rust-timer" {
102+
return Ok(github::Response);
103+
}
104+
100105
if comment.author_association != github::Association::Owner
101106
&& !get_authorized_users().await?.contains(&comment.user.id)
102107
{
@@ -159,8 +164,8 @@ async fn handle_rust_timer(
159164
}
160165
}
161166

162-
if valid_build_cmds.is_empty() {
163-
errors.push_str("@rust-timer command cannot be empty\n");
167+
if valid_build_cmds.is_empty() && errors.is_empty() {
168+
errors.push_str("Command cannot be empty\n");
164169
}
165170

166171
if !errors.is_empty() {

0 commit comments

Comments
 (0)