From cc7bd3a41656ce1dd61afaa7c6bb690543f17791 Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 19 Aug 2024 09:55:01 +0200 Subject: [PATCH] maybe unpublishing a post works now? --- src/model/notification.rs | 1 + src/tera/mod.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/model/notification.rs b/src/model/notification.rs index 0dcf45a..74b0f48 100644 --- a/src/model/notification.rs +++ b/src/model/notification.rs @@ -181,6 +181,7 @@ ORDER BY read_at DESC, created_at DESC; } pub(crate) async fn delete_by_link(db: &sqlx::Pool, link: &str) { + let link = Some(link); sqlx::query!("DELETE FROM notification WHERE link=?", link) .execute(db) .await diff --git a/src/tera/mod.rs b/src/tera/mod.rs index 9094c40..0f71aaa 100644 --- a/src/tera/mod.rs +++ b/src/tera/mod.rs @@ -161,7 +161,11 @@ async fn blogpost_unpublished( config: &State, ) -> String { if blogpost.pw == &config.wordpress_key { - Notification::delete_by_link(&db, blogpost.article_url).await; + Notification::delete_by_link( + &db, + &urlencoding::decode(blogpost.article_url).expect("UTF-8"), + ) + .await; "ACK".into() } else { "WRONG pw".into() -- 2.45.2