remove unused function

federate-purges
Felix Ableitner 4 months ago
parent eee231e8d5
commit 5df2598dba

@ -29,7 +29,6 @@ use activitypub_federation::{
};
use lemmy_api_common::{context::LemmyContext, utils::purge_user_account};
use lemmy_db_schema::{
newtypes::CommunityId,
source::{
activity::ActivitySendTargets,
comment::{Comment, CommentUpdateForm},
@ -58,38 +57,6 @@ pub(crate) async fn send_apub_delete_in_community(
deleted: bool,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let actor = ApubPerson::from(actor);
let is_mod_action = reason.is_some();
let activity = if deleted {
let delete = Delete::new(&actor, object, public(), Some(&community), reason, context)?;
AnnouncableActivities::Delete(delete)
} else {
let undo = UndoDelete::new(&actor, object, public(), Some(&community), reason, context)?;
AnnouncableActivities::UndoDelete(undo)
};
send_activity_in_community(
activity,
&actor,
&community.into(),
ActivitySendTargets::empty(),
is_mod_action,
context,
)
.await
}
/// Parameter `reason` being set indicates that this is a removal by a mod. If its unset, this
/// action was done by a normal user.
#[tracing::instrument(skip_all)]
pub(crate) async fn send_apub_delete_in_community_new(
actor: Person,
community_id: CommunityId,
object: DeletableObjects,
reason: Option<String>,
deleted: bool,
context: Data<LemmyContext>,
) -> Result<(), LemmyError> {
let community = Community::read(&mut context.pool(), community_id).await?;
let actor = ApubPerson::from(actor);
let is_mod_action = reason.is_some();
let activity = if deleted {

@ -10,7 +10,6 @@ use crate::{
create_or_update::private_message::send_create_or_update_pm,
deletion::{
send_apub_delete_in_community,
send_apub_delete_in_community_new,
send_apub_delete_private_message,
send_apub_delete_user,
DeletableObjects,
@ -35,9 +34,12 @@ use lemmy_api_common::{
context::LemmyContext,
send_activity::{ActivityChannel, SendActivityData},
};
use lemmy_db_schema::source::{
activity::{ActivitySendTargets, ActorType, SentActivity, SentActivityForm},
community::Community,
use lemmy_db_schema::{
source::{
activity::{ActivitySendTargets, ActorType, SentActivity, SentActivityForm},
community::Community,
},
traits::Crud,
};
use lemmy_db_views_actor::structs::{CommunityPersonBanView, CommunityView};
use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType, LemmyResult};
@ -246,13 +248,14 @@ pub async fn match_outgoing_activities(
CreateOrUpdatePage::send(post, creator_id, CreateOrUpdateType::Update, context).await
}
DeletePost(post, person, data) => {
send_apub_delete_in_community_new(
let community = Community::read(&mut context.pool(), post.community_id).await?;
send_apub_delete_in_community(
person,
post.community_id,
community,
DeletableObjects::Post(post.into()),
None,
data.deleted,
context,
&context,
)
.await
}
@ -262,13 +265,14 @@ pub async fn match_outgoing_activities(
reason,
removed,
} => {
send_apub_delete_in_community_new(
let community = Community::read(&mut context.pool(), post.community_id).await?;
send_apub_delete_in_community(
moderator,
post.community_id,
community,
DeletableObjects::Post(post.into()),
reason.or_else(|| Some(String::new())),
removed,
context,
&context,
)
.await
}

Loading…
Cancel
Save