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

View file

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

View file

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