mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-02-23 06:06:22 +00:00
Rename purge function to delete.
This commit is contained in:
parent
6c34979f34
commit
3561b6f92f
2 changed files with 7 additions and 6 deletions
|
@ -5,7 +5,7 @@ use lemmy_api_common::{
|
|||
context::LemmyContext,
|
||||
send_activity::{ActivityChannel, SendActivityData},
|
||||
site::PurgePerson,
|
||||
utils::{is_admin, purge_local_user_images},
|
||||
utils::{delete_local_user_images, is_admin},
|
||||
SuccessResponse,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
|
@ -26,8 +26,9 @@ pub async fn purge_person(
|
|||
) -> Result<Json<SuccessResponse>, LemmyError> {
|
||||
// Only let admin purge an item
|
||||
is_admin(&local_user_view)?;
|
||||
|
||||
purge_local_user_images(data.person_id, &context).await.ok();
|
||||
delete_local_user_images(data.person_id, &context)
|
||||
.await
|
||||
.ok();
|
||||
|
||||
let person = Person::read(&mut context.pool(), data.person_id).await?;
|
||||
ban_nonlocal_user_from_local_communities(
|
||||
|
|
|
@ -616,15 +616,15 @@ pub async fn purge_image_posts_for_person(
|
|||
}
|
||||
|
||||
/// Delete a local_user's images
|
||||
pub async fn purge_local_user_images(
|
||||
pub async fn delete_local_user_images(
|
||||
person_id: PersonId,
|
||||
context: &LemmyContext,
|
||||
) -> Result<(), LemmyError> {
|
||||
// Delete their images
|
||||
if let Ok(local_user) = LocalUserView::read_person(&mut context.pool(), person_id).await {
|
||||
let pictrs_uploads =
|
||||
LocalImage::get_all_by_local_user_id(&mut context.pool(), &local_user.local_user.id).await?;
|
||||
|
||||
// Delete their images
|
||||
for upload in pictrs_uploads {
|
||||
delete_image_from_pictrs(&upload.pictrs_alias, &upload.pictrs_delete_token, context)
|
||||
.await
|
||||
|
@ -779,7 +779,7 @@ pub async fn purge_user_account(
|
|||
let person = Person::read(pool, person_id).await?;
|
||||
|
||||
// Delete their local images, if they're a local user
|
||||
purge_local_user_images(person_id, context).await.ok();
|
||||
delete_local_user_images(person_id, context).await.ok();
|
||||
|
||||
// No need to update avatar and banner, those are handled in Person::delete_account
|
||||
if let Some(avatar) = person.avatar {
|
||||
|
|
Loading…
Reference in a new issue