Replace moderation project queue with moderation action log (#718)

This commit is contained in:
Emma Alexia Triphora
2023-09-24 12:04:58 -04:00
committed by GitHub
parent 3767e9fae9
commit 51777c3f33
3 changed files with 20 additions and 98 deletions

View File

@@ -875,20 +875,6 @@ async fn project_create_inner(
monetization_status: MonetizationStatus::Monetized,
};
if status == ProjectStatus::Processing {
if let Ok(webhook_url) = dotenvy::var("MODERATION_DISCORD_WEBHOOK") {
crate::util::webhook::send_discord_webhook(
response.id,
pool,
redis,
webhook_url,
None,
)
.await
.ok();
}
}
Ok(HttpResponse::Ok().json(response))
}
}

View File

@@ -493,18 +493,6 @@ pub async fn project_edit(
)
.execute(&mut *transaction)
.await?;
if let Ok(webhook_url) = dotenvy::var("MODERATION_DISCORD_WEBHOOK") {
crate::util::webhook::send_discord_webhook(
project_item.inner.id.into(),
&pool,
&redis,
webhook_url,
None,
)
.await
.ok();
}
}
if status.is_approved() && !project_item.inner.status.is_approved() {
@@ -545,6 +533,26 @@ 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(
project_item.inner.id.into(),
&pool,
&redis,
webhook_url,
Some(
format!(
"**[{}]({}/user/{})** changed project status from **{}** to **{}**",
user.username, dotenvy::var("SITE_URL")?, user.username, &project_item.inner.status, status
)
.to_string(),
),
)
.await
.ok();
}
}
if team_member.map(|x| !x.accepted).unwrap_or(true) {
let notified_members = sqlx::query!(
"