From 7f0cb1f2a1c1dc07f38b3f4b47b971635798829a Mon Sep 17 00:00:00 2001 From: trisua Date: Sun, 10 Aug 2025 12:32:20 -0400 Subject: [PATCH] fix: user and post deletion --- crates/core/src/database/auth.rs | 2 +- crates/core/src/database/posts.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/core/src/database/auth.rs b/crates/core/src/database/auth.rs index 0e9da53..178fb29 100644 --- a/crates/core/src/database/auth.rs +++ b/crates/core/src/database/auth.rs @@ -543,7 +543,7 @@ impl DataManager { // delete transfers let res = execute!( &conn, - "DELETE FROM transfers WHERE sender = $1 OR receiver = $2", + "DELETE FROM transfers WHERE sender = $1 OR receiver = $1", &[&(id as i64)] ); diff --git a/crates/core/src/database/posts.rs b/crates/core/src/database/posts.rs index 7a7a2a7..35448de 100644 --- a/crates/core/src/database/posts.rs +++ b/crates/core/src/database/posts.rs @@ -2221,7 +2221,9 @@ impl DataManager { // decr parent comment count if let Some(replying_to) = y.replying_to { - self.decr_post_comments(replying_to).await.unwrap(); + if replying_to != 0 { + self.decr_post_comments(replying_to).await.unwrap(); + } } // decr user post count