Slack webhooks (#959)

* Slack webhooks

* Fix automod rejecting audio and locale packs

* Run prepare
This commit is contained in:
Geometrically
2024-09-06 23:42:54 -07:00
committed by GitHub
parent 2e35f3608b
commit cb0f03ca9c
6 changed files with 360 additions and 282 deletions

View File

@@ -249,6 +249,7 @@ pub struct OAuthClientEdit {
)]
pub name: Option<String>,
#[validate(custom(function = "crate::util::validate::validate_no_restricted_scopes"))]
pub max_scopes: Option<Scopes>,
#[validate(length(min = 1))]

View File

@@ -398,18 +398,18 @@ pub async fn project_edit(
}
if user.role.is_mod() {
if let Ok(webhook_url) = dotenvy::var("MODERATION_DISCORD_WEBHOOK") {
crate::util::webhook::send_discord_webhook(
if let Ok(webhook_url) = dotenvy::var("MODERATION_SLACK_WEBHOOK") {
crate::util::webhook::send_slack_webhook(
project_item.inner.id.into(),
&pool,
&redis,
webhook_url,
Some(
format!(
"**[{}]({}/user/{})** changed project status from **{}** to **{}**",
user.username,
"*<{}/user/{}|{}>* changed project status from *{}* to *{}*",
dotenvy::var("SITE_URL")?,
user.username,
user.username,
&project_item.inner.status.as_friendly_str(),
status.as_friendly_str(),
)