You've already forked AstralRinth
forked from didirus/AstralRinth
Slack webhook for payout source threshold alerts (#4353)
* Slack webhook for payout alerts * add PAYOUT_ALERT_SLACK_WEBHOOK to check_env_vars * Fix commit * Fix webhook format * Add new env vars in .env.local * Rename env vars, fire webhook on error * Fix compilation * Clippy * Fix CI * Add env vars to .env.docker-compose
This commit is contained in:
committed by
GitHub
parent
af3b829449
commit
58aac642a9
@@ -210,7 +210,7 @@ pub async fn delphi_result_ingest(
|
||||
}
|
||||
}
|
||||
|
||||
crate::util::webhook::send_slack_webhook(
|
||||
crate::util::webhook::send_slack_project_webhook(
|
||||
body.project_id,
|
||||
&pool,
|
||||
&redis,
|
||||
|
||||
@@ -119,6 +119,8 @@ pub enum ApiError {
|
||||
Payments(String),
|
||||
#[error("Discord Error: {0}")]
|
||||
Discord(String),
|
||||
#[error("Slack Webhook Error: {0}")]
|
||||
Slack(String),
|
||||
#[error("Captcha Error. Try resubmitting the form.")]
|
||||
Turnstile,
|
||||
#[error("Error while decoding Base62: {0}")]
|
||||
@@ -182,6 +184,7 @@ impl ApiError {
|
||||
ApiError::Io(..) => "io_error",
|
||||
ApiError::RateLimitError(..) => "ratelimit_error",
|
||||
ApiError::Stripe(..) => "stripe_error",
|
||||
ApiError::Slack(..) => "slack_error",
|
||||
},
|
||||
description: self.to_string(),
|
||||
}
|
||||
@@ -220,6 +223,7 @@ impl actix_web::ResponseError for ApiError {
|
||||
ApiError::Io(..) => StatusCode::BAD_REQUEST,
|
||||
ApiError::RateLimitError(..) => StatusCode::TOO_MANY_REQUESTS,
|
||||
ApiError::Stripe(..) => StatusCode::FAILED_DEPENDENCY,
|
||||
ApiError::Slack(..) => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ pub async fn project_edit(
|
||||
if user.role.is_mod()
|
||||
&& let Ok(webhook_url) = dotenvy::var("MODERATION_SLACK_WEBHOOK")
|
||||
{
|
||||
crate::util::webhook::send_slack_webhook(
|
||||
crate::util::webhook::send_slack_project_webhook(
|
||||
project_item.inner.id.into(),
|
||||
&pool,
|
||||
&redis,
|
||||
|
||||
Reference in New Issue
Block a user