Fix AI review
Webhook action check before user check
This commit is contained in:
1 parent
3f6c5b5559
commit
00d46ce968
4 files changed
+13
-13
No files matched your search
+8
-8
@@ -206,14 +206,6 @@ impl WebhookType {
|
||||
_ => Err(AppError::UnknownEventErr),
|
||||
}?;
|
||||
|
||||
let pr_body = match &wb {
|
||||
WebhookType::Review(review_payload) => &review_payload.comment.body,
|
||||
};
|
||||
|
||||
if !pr_body.starts_with(&format!("@{}", bot_name)) {
|
||||
return Err(AppError::UnauthorizedUserErr);
|
||||
}
|
||||
|
||||
let action = match &wb {
|
||||
WebhookType::Review(review_payload) => &review_payload.action,
|
||||
};
|
||||
@@ -222,6 +214,14 @@ impl WebhookType {
|
||||
return Err(AppError::InvalidActionErr);
|
||||
}
|
||||
|
||||
let pr_body = match &wb {
|
||||
WebhookType::Review(review_payload) => &review_payload.comment.body,
|
||||
};
|
||||
|
||||
if !pr_body.starts_with(&format!("@{}", bot_name)) {
|
||||
return Err(AppError::UnauthorizedUserErr);
|
||||
}
|
||||
|
||||
Ok(wb)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user