Revert "Refactoring delete apub."

This reverts commit ba2c3d06cfb870efe792f4b2541036265b425156.
This commit is contained in:
Dessalines 2021-11-03 12:21:25 -04:00
parent f75e1e9f60
commit 8f462ed3a2
3 changed files with 5 additions and 11 deletions

View file

@ -24,7 +24,7 @@ use lemmy_utils::{
utils::{convert_datetime, remove_slurs},
LemmyError,
};
use lemmy_websocket::{send::send_comment_ws_message_simple, LemmyContext, UserOperationCrud};
use lemmy_websocket::LemmyContext;
use crate::{
activities::verify_person_in_community,
@ -82,12 +82,10 @@ impl ApubObject for ApubComment {
async fn delete(self, context: &LemmyContext) -> Result<(), LemmyError> {
if !self.deleted {
let id = self.id;
blocking(context.pool(), move |conn| {
Comment::update_deleted(conn, self.id, true)
})
.await??;
send_comment_ws_message_simple(id, UserOperationCrud::DeleteComment, context).await?;
}
Ok(())
}

View file

@ -31,7 +31,7 @@ use lemmy_utils::{
utils::{convert_datetime, markdown_to_html},
LemmyError,
};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
use lemmy_websocket::LemmyContext;
#[derive(Clone, Debug)]
pub struct ApubCommunity(Community);
@ -73,12 +73,10 @@ impl ApubObject for ApubCommunity {
}
async fn delete(self, context: &LemmyContext) -> Result<(), LemmyError> {
let id = self.id;
blocking(context.pool(), move |conn| {
Community::update_deleted(conn, id, true)
Community::update_deleted(conn, self.id, true)
})
.await??;
send_community_ws_message(id, UserOperationCrud::DeleteCommunity, None, None, context).await?;
Ok(())
}

View file

@ -32,7 +32,7 @@ use lemmy_utils::{
utils::{convert_datetime, markdown_to_html, remove_slurs},
LemmyError,
};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
use lemmy_websocket::LemmyContext;
use std::ops::Deref;
use url::Url;
@ -77,12 +77,10 @@ impl ApubObject for ApubPost {
async fn delete(self, context: &LemmyContext) -> Result<(), LemmyError> {
if !self.deleted {
let id = self.id;
blocking(context.pool(), move |conn| {
Post::update_deleted(conn, id, true)
Post::update_deleted(conn, self.id, true)
})
.await??;
send_post_ws_message(id, UserOperationCrud::DeletePost, None, None, context).await?;
}
Ok(())
}