From abc99c7e69e425156d1c2ae6e4ec9057d5152e1f Mon Sep 17 00:00:00 2001 From: Geometrically <18202329+Geometrically@users.noreply.github.com> Date: Thu, 1 Jun 2023 08:53:16 -0700 Subject: [PATCH] Fix report + mod deletion (#626) --- src/database/models/project_item.rs | 12 ++++++------ src/database/models/report_item.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/database/models/project_item.rs b/src/database/models/project_item.rs index 5c8c19263..147843187 100644 --- a/src/database/models/project_item.rs +++ b/src/database/models/project_item.rs @@ -394,12 +394,6 @@ impl Project { .fetch_optional(&mut *transaction) .await?; - if let Some(thread_id) = thread_id { - if let Some(id) = thread_id.thread_id { - crate::database::models::Thread::remove_full(ThreadId(id), transaction).await?; - } - } - sqlx::query!( " DELETE FROM mod_follows @@ -527,6 +521,12 @@ impl Project { .execute(&mut *transaction) .await?; + if let Some(thread_id) = thread_id { + if let Some(id) = thread_id.thread_id { + crate::database::models::Thread::remove_full(ThreadId(id), transaction).await?; + } + } + Ok(Some(())) } diff --git a/src/database/models/report_item.rs b/src/database/models/report_item.rs index 11775d08e..bd352a740 100644 --- a/src/database/models/report_item.rs +++ b/src/database/models/report_item.rs @@ -135,12 +135,6 @@ impl Report { .fetch_optional(&mut *transaction) .await?; - if let Some(thread_id) = thread_id { - if let Some(id) = thread_id.thread_id { - crate::database::models::Thread::remove_full(ThreadId(id), transaction).await?; - } - } - sqlx::query!( " DELETE FROM reports WHERE id = $1 @@ -150,6 +144,12 @@ impl Report { .execute(&mut *transaction) .await?; + if let Some(thread_id) = thread_id { + if let Some(id) = thread_id.thread_id { + crate::database::models::Thread::remove_full(ThreadId(id), transaction).await?; + } + } + Ok(Some(())) } }