post::{DeletePost, PostResponse, RemovePost},
private_message::{DeletePrivateMessage, PrivateMessageResponse},
utils::local_user_view_from_jwt,
- websocket::UserOperationCrud,
};
use lemmy_db_schema::{
source::{
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
- let community = Community::read(context.pool(), response.post_view.community.id).await?;
+ let community = Community::read(&mut context.pool(), response.post_view.community.id).await?;
let deletable = DeletableObjects::Post(response.post_view.post.clone().into());
send_apub_delete_in_community(
local_user_view.person,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
- let community = Community::read(context.pool(), response.post_view.community.id).await?;
+ let community = Community::read(&mut context.pool(), response.post_view.community.id).await?;
let deletable = DeletableObjects::Post(response.post_view.post.clone().into());
send_apub_delete_in_community(
local_user_view.person,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let community_id = response.comment_view.community.id;
- let community = Community::read(context.pool(), community_id).await?;
- let person = Person::read(context.pool(), response.comment_view.creator.id).await?;
+ let community = Community::read(&mut context.pool(), community_id).await?;
+ let person = Person::read(&mut context.pool(), response.comment_view.creator.id).await?;
let deletable = DeletableObjects::Comment(response.comment_view.comment.clone().into());
send_apub_delete_in_community(person, community, deletable, None, request.deleted, context)
.await
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
- let comment = Comment::read(context.pool(), request.comment_id).await?;
- let community = Community::read(context.pool(), response.comment_view.community.id).await?;
+ let comment = Comment::read(&mut context.pool(), request.comment_id).await?;
+ let community =
+ Community::read(&mut context.pool(), response.comment_view.community.id).await?;
let deletable = DeletableObjects::Comment(comment.into());
send_apub_delete_in_community(
local_user_view.person,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
- let community = Community::read(context.pool(), request.community_id).await?;
+ let community = Community::read(&mut context.pool(), request.community_id).await?;
let deletable = DeletableObjects::Community(community.clone().into());
send_apub_delete_in_community(
local_user_view.person,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
- let community = Community::read(context.pool(), request.community_id).await?;
+ let community = Community::read(&mut context.pool(), request.community_id).await?;
let deletable = DeletableObjects::Community(community.clone().into());
send_apub_delete_in_community(
local_user_view.person,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let recipient_id = pm.recipient_id;
- let recipient: ApubPerson = Person::read(context.pool(), recipient_id).await?.into();
+ let recipient: ApubPerson = Person::read(&mut context.pool(), recipient_id)
+ .await?
+ .into();
let deletable = DeletableObjects::PrivateMessage(pm.into());
let inbox = vec![recipient.shared_inbox_or_inbox()];
send_apub_delete_in_community(mod_, c, object, None, true, context).await?;
}
- let community = Community::update(
- context.pool(),
+ Community::update(
+ &mut context.pool(),
community.id,
&CommunityUpdateForm::builder()
.deleted(Some(deleted))
.build(),
)
.await?;
- context
- .send_community_ws_message(
- &UserOperationCrud::DeleteCommunity,
- community.id,
- None,
- None,
- )
- .await?;
}
DeletableObjects::Post(post) => {
if deleted != post.deleted {
- let deleted_post = Post::update(
- context.pool(),
+ Post::update(
+ &mut context.pool(),
post.id,
&PostUpdateForm::builder().deleted(Some(deleted)).build(),
)
.await?;
- context
- .send_post_ws_message(&UserOperationCrud::DeletePost, deleted_post.id, None, None)
- .await?;
}
}
DeletableObjects::Comment(comment) => {
if deleted != comment.deleted {
- let deleted_comment = Comment::update(
- context.pool(),
+ Comment::update(
+ &mut context.pool(),
comment.id,
&CommentUpdateForm::builder().deleted(Some(deleted)).build(),
)
.await?;
- context
- .send_comment_ws_message_simple(&UserOperationCrud::DeleteComment, deleted_comment.id)
- .await?;
}
}
DeletableObjects::PrivateMessage(pm) => {
- let deleted_private_message = PrivateMessage::update(
- context.pool(),
+ PrivateMessage::update(
+ &mut context.pool(),
pm.id,
&PrivateMessageUpdateForm::builder()
.deleted(Some(deleted))
.build(),
)
.await?;
-
- context
- .send_pm_ws_message(
- &UserOperationCrud::DeletePrivateMessage,
- deleted_private_message.id,
- None,
- )
- .await?;
}
}
Ok(())