mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 11:21:02 +00:00
When purging a federated user, federate local community removals. (#4505)
This commit is contained in:
parent
1ad9a211c9
commit
6778279bb6
1 changed files with 14 additions and 1 deletions
|
@ -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 a new issue