deletion::{receive_delete_action, verify_delete_activity, DeletableObjects},
generate_activity_id,
},
+ check_apub_id_valid,
+ fetch_local_site_data,
local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::{activities::deletion::delete::Delete, IdOrNestedObject},
use lemmy_api_common::utils::blocking;
use lemmy_db_schema::{
source::{
- comment::Comment,
- community::Community,
+ comment::{Comment, CommentUpdateForm},
+ community::{Community, CommunityUpdateForm},
moderator::{
ModRemoveComment,
ModRemoveCommentForm,
ModRemovePost,
ModRemovePostForm,
},
- post::Post,
+ post::{Post, PostUpdateForm},
},
traits::Crud,
};
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
+ let local_site_data = blocking(context.pool(), fetch_local_site_data).await??;
+ check_apub_id_valid(self.id(), &local_site_data, context.settings())
+ .map_err(LemmyError::from_message)?;
verify_delete_activity(self, self.summary.is_some(), context, request_counter).await?;
Ok(())
}
})
.await??;
let deleted_community = blocking(context.pool(), move |conn| {
- Community::update_removed(conn, community.id, true)
+ Community::update(
+ conn,
+ community.id,
+ &CommunityUpdateForm::builder().removed(Some(true)).build(),
+ )
})
.await??;
})
.await??;
let removed_post = blocking(context.pool(), move |conn| {
- Post::update_removed(conn, post.id, true)
+ Post::update(
+ conn,
+ post.id,
+ &PostUpdateForm::builder().removed(Some(true)).build(),
+ )
})
.await??;
})
.await??;
let removed_comment = blocking(context.pool(), move |conn| {
- Comment::update_removed(conn, comment.id, true)
+ Comment::update(
+ conn,
+ comment.id,
+ &CommentUpdateForm::builder().removed(Some(true)).build(),
+ )
})
.await??;