X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fapi_crud%2Fsrc%2Fcomment%2Fremove.rs;h=c18a8c5b7486f24ce217435cbf8cc732781c5941;hb=f7f6766650b9b573a72075e564aed353c0131cd7;hp=b2071298656f6074f07223d6c0c68c57337ab626;hpb=d82194cfe9f98984a64353f6511bb73b4f08baa4;p=lemmy.git diff --git a/crates/api_crud/src/comment/remove.rs b/crates/api_crud/src/comment/remove.rs index b2071298..c18a8c5b 100644 --- a/crates/api_crud/src/comment/remove.rs +++ b/crates/api_crud/src/comment/remove.rs @@ -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}; @@ -48,11 +49,17 @@ pub async fn remove_comment( let updated_comment = Comment::update( &mut context.pool(), comment_id, - &CommentUpdateForm::builder().removed(Some(removed)).build(), + &CommentUpdateForm { + removed: Some(removed), + ..Default::default() + }, ) .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, @@ -91,7 +98,6 @@ pub async fn remove_comment( &context, updated_comment_id, Some(local_user_view), - None, recipient_ids, ) .await?,