add options to choose if quote should be sent via discord webhook
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user