mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
When purging a federated user, federate local community removals.
This commit is contained in:
parent
7f9950fe85
commit
cec61d116b
@ -1,3 +1,4 @@
|
||||
use crate::ban_nonlocal_user_from_local_communities;
|
||||
use activitypub_federation::config::Data;
|
||||
use actix_web::web::Json;
|
||||
use lemmy_api_common::{
|
||||
@ -28,7 +29,7 @@ pub async fn purge_person(
|
||||
// Only let admin purge an item
|
||||
is_admin(&local_user_view)?;
|
||||
|
||||
// Read the person to get their images
|
||||
// Read the local user to get their images, and delete them
|
||||
if let Ok(local_user) = LocalUserView::read_person(&mut context.pool(), data.person_id).await {
|
||||
let pictrs_uploads =
|
||||
LocalImage::get_all_by_local_user_id(&mut context.pool(), &local_user.local_user.id).await?;
|
||||
@ -40,6 +41,18 @@ pub async fn purge_person(
|
||||
}
|
||||
}
|
||||
|
||||
let person = Person::read(&mut context.pool(), data.person_id).await?;
|
||||
ban_nonlocal_user_from_local_communities(
|
||||
&local_user_view,
|
||||
&person,
|
||||
true,
|
||||
&data.reason,
|
||||
&Some(true),
|
||||
&None,
|
||||
&context,
|
||||
)
|
||||
.await?;
|
||||
|
||||
// Clear profile data.
|
||||
Person::delete_account(&mut context.pool(), data.person_id).await?;
|
||||
// Keep person record, but mark as banned to prevent login or refetching from home instance.
|
||||
|
Loading…
Reference in New Issue
Block a user