use lemmy_db_schema::{
source::{
comment::{Comment, CommentUpdateForm},
+ comment_report::CommentReport,
community::{Community, CommunityUpdateForm},
moderator::{
ModRemoveComment,
ModRemovePostForm,
},
post::{Post, PostUpdateForm},
+ post_report::PostReport,
},
- traits::Crud,
+ traits::{Crud, Reportable},
};
use lemmy_utils::error::{LemmyError, LemmyErrorType};
use url::Url;
Community::update(
&mut context.pool(),
community.id,
- &CommunityUpdateForm::builder().removed(Some(true)).build(),
+ &CommunityUpdateForm {
+ removed: Some(true),
+ ..Default::default()
+ },
)
.await?;
}
DeletableObjects::Post(post) => {
+ PostReport::resolve_all_for_object(&mut context.pool(), post.id, actor.id).await?;
let form = ModRemovePostForm {
mod_person_id: actor.id,
post_id: post.id,
Post::update(
&mut context.pool(),
post.id,
- &PostUpdateForm::builder().removed(Some(true)).build(),
+ &PostUpdateForm {
+ removed: Some(true),
+ ..Default::default()
+ },
)
.await?;
}
DeletableObjects::Comment(comment) => {
+ CommentReport::resolve_all_for_object(&mut context.pool(), comment.id, actor.id).await?;
let form = ModRemoveCommentForm {
mod_person_id: actor.id,
comment_id: comment.id,
Comment::update(
&mut context.pool(),
comment.id,
- &CommentUpdateForm::builder().removed(Some(true)).build(),
+ &CommentUpdateForm {
+ removed: Some(true),
+ ..Default::default()
+ },
)
.await?;
}