add options to choose if quote should be sent via discord webhook

This commit is contained in:
2026-05-01 16:13:51 +02:00
parent be462dc662
commit 4d49a5c0b3
2 changed files with 25 additions and 2 deletions

View File

@@ -53,6 +53,8 @@ pub struct QuoteCreateForm {
pub context: Option<String>,
pub location: Option<String>,
pub public: bool,
#[serde(default)]
pub discord_webhook: bool,
}
pub async fn create(
@@ -85,5 +87,12 @@ pub async fn create(
LogEntry::new(&mut tx, u, LogAction::CreateQuote { id: q.id }).await?;
tx.commit().await?;
if form.discord_webhook {
if let Some(ref url) = state.conf.read().await.discord_webhook {
q.post_msg_webhook(url.clone());
}
}
Ok((StatusCode::CREATED, Json(q)).into_response())
}