use lemmy_api_common::utils::blocking;
use lemmy_db_schema::{
source::{
- comment::Comment,
- community::Community,
+ comment::{Comment, CommentUpdateForm},
+ community::{Community, CommunityUpdateForm},
person::Person,
- post::Post,
- private_message::PrivateMessage,
+ post::{Post, PostUpdateForm},
+ private_message::{PrivateMessage, PrivateMessageUpdateForm},
},
traits::Crud,
};
verify_mod_action(
&activity.actor,
activity.object.id(),
- &community,
+ community.id,
context,
request_counter,
)
) -> Result<(), LemmyError> {
verify_person_in_community(actor, community, context, request_counter).await?;
if is_mod_action {
- verify_mod_action(actor, object_id, community, context, request_counter).await?;
+ verify_mod_action(actor, object_id, community.id, context, request_counter).await?;
} else {
// domain of post ap_id and post.creator ap_id are identical, so we just check the former
verify_domains_match(actor.inner(), object_id)?;
}
let community = blocking(context.pool(), move |conn| {
- Community::update_deleted(conn, community.id, deleted)
+ Community::update(
+ conn,
+ community.id,
+ &CommunityUpdateForm::builder()
+ .deleted(Some(deleted))
+ .build(),
+ )
})
.await??;
send_community_ws_message(
DeletableObjects::Post(post) => {
if deleted != post.deleted {
let deleted_post = blocking(context.pool(), move |conn| {
- Post::update_deleted(conn, post.id, deleted)
+ Post::update(
+ conn,
+ post.id,
+ &PostUpdateForm::builder().deleted(Some(deleted)).build(),
+ )
})
.await??;
send_post_ws_message(
DeletableObjects::Comment(comment) => {
if deleted != comment.deleted {
let deleted_comment = blocking(context.pool(), move |conn| {
- Comment::update_deleted(conn, comment.id, deleted)
+ Comment::update(
+ conn,
+ comment.id,
+ &CommentUpdateForm::builder().deleted(Some(deleted)).build(),
+ )
})
.await??;
send_comment_ws_message_simple(
}
DeletableObjects::PrivateMessage(pm) => {
let deleted_private_message = blocking(context.pool(), move |conn| {
- PrivateMessage::update_deleted(conn, pm.id, deleted)
+ PrivateMessage::update(
+ conn,
+ pm.id,
+ &PrivateMessageUpdateForm::builder()
+ .deleted(Some(deleted))
+ .build(),
+ )
})
.await??;