]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/comment/remove.rs
Automatically resolve report when post/comment is removed (#3850)
[lemmy.git] / crates / api_crud / src / comment / remove.rs
index 2bb5c75f2f9b9fdf12de3b6ee9f105254eb0eb2a..c18a8c5b7486f24ce217435cbf8cc732781c5941 100644 (file)
@@ -10,10 +10,11 @@ use lemmy_api_common::{
 use lemmy_db_schema::{
   source::{
     comment::{Comment, CommentUpdateForm},
+    comment_report::CommentReport,
     moderator::{ModRemoveComment, ModRemoveCommentForm},
     post::Post,
   },
-  traits::Crud,
+  traits::{Crud, Reportable},
 };
 use lemmy_db_views::structs::CommentView;
 use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType};
@@ -56,6 +57,9 @@ pub async fn remove_comment(
   .await
   .with_lemmy_type(LemmyErrorType::CouldntUpdateComment)?;
 
+  CommentReport::resolve_all_for_object(&mut context.pool(), comment_id, local_user_view.person.id)
+    .await?;
+
   // Mod tables
   let form = ModRemoveCommentForm {
     mod_person_id: local_user_view.person.id,