Use purge_user_account instead of Person::delete_account in purge person.

This commit is contained in:
Dessalines 2024-03-26 11:28:44 -04:00
parent 8c99a5598d
commit 9c45a199f8

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
context::LemmyContext, context::LemmyContext,
send_activity::{ActivityChannel, SendActivityData}, send_activity::{ActivityChannel, SendActivityData},
site::PurgePerson, site::PurgePerson,
utils::{delete_local_user_images, is_admin}, utils::{delete_local_user_images, is_admin, purge_user_account},
SuccessResponse, SuccessResponse,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
@ -26,9 +26,6 @@ pub async fn purge_person(
) -> Result<Json<SuccessResponse>, LemmyError> { ) -> Result<Json<SuccessResponse>, LemmyError> {
// Only let admin purge an item // Only let admin purge an item
is_admin(&local_user_view)?; is_admin(&local_user_view)?;
delete_local_user_images(data.person_id, &context)
.await
.ok();
let person = Person::read(&mut context.pool(), data.person_id).await?; let person = Person::read(&mut context.pool(), data.person_id).await?;
ban_nonlocal_user_from_local_communities( ban_nonlocal_user_from_local_communities(
@ -43,7 +40,8 @@ pub async fn purge_person(
.await?; .await?;
// Clear profile data. // Clear profile data.
Person::delete_account(&mut context.pool(), data.person_id).await?; purge_user_account(data.person_id, &mut context.pool()).await?;
// Keep person record, but mark as banned to prevent login or refetching from home instance. // Keep person record, but mark as banned to prevent login or refetching from home instance.
let person = Person::update( let person = Person::update(
&mut context.pool(), &mut context.pool(),