Merge pull request 'maybe unpublishing a post works now?' (#683) from fix into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m3s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 6m33s

Reviewed-on: #683
This commit is contained in:
philipp 2024-08-19 09:55:46 +02:00
commit c41dc0853a
2 changed files with 6 additions and 1 deletions

View File

@ -181,6 +181,7 @@ ORDER BY read_at DESC, created_at DESC;
} }
pub(crate) async fn delete_by_link(db: &sqlx::Pool<Sqlite>, link: &str) { pub(crate) async fn delete_by_link(db: &sqlx::Pool<Sqlite>, link: &str) {
let link = Some(link);
sqlx::query!("DELETE FROM notification WHERE link=?", link) sqlx::query!("DELETE FROM notification WHERE link=?", link)
.execute(db) .execute(db)
.await .await

View File

@ -161,7 +161,11 @@ async fn blogpost_unpublished(
config: &State<Config>, config: &State<Config>,
) -> String { ) -> String {
if blogpost.pw == &config.wordpress_key { 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() "ACK".into()
} else { } else {
"WRONG pw".into() "WRONG pw".into()