mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-02-23 14:16:26 +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,
|
context::LemmyContext,
|
||||||
send_activity::{ActivityChannel, SendActivityData},
|
send_activity::{ActivityChannel, SendActivityData},
|
||||||
site::PurgePerson,
|
site::PurgePerson,
|
||||||
utils::{is_admin, purge_local_user_images},
|
utils::{delete_local_user_images, is_admin},
|
||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
|
@ -26,8 +26,9 @@ 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)
|
||||||
purge_local_user_images(data.person_id, &context).await.ok();
|
.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(
|
||||||
|
|
|
@ -616,15 +616,15 @@ pub async fn purge_image_posts_for_person(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delete a local_user's images
|
/// Delete a local_user's images
|
||||||
pub async fn purge_local_user_images(
|
pub async fn delete_local_user_images(
|
||||||
person_id: PersonId,
|
person_id: PersonId,
|
||||||
context: &LemmyContext,
|
context: &LemmyContext,
|
||||||
) -> Result<(), LemmyError> {
|
) -> Result<(), LemmyError> {
|
||||||
// Delete their images
|
|
||||||
if let Ok(local_user) = LocalUserView::read_person(&mut context.pool(), person_id).await {
|
if let Ok(local_user) = LocalUserView::read_person(&mut context.pool(), person_id).await {
|
||||||
let pictrs_uploads =
|
let pictrs_uploads =
|
||||||
LocalImage::get_all_by_local_user_id(&mut context.pool(), &local_user.local_user.id).await?;
|
LocalImage::get_all_by_local_user_id(&mut context.pool(), &local_user.local_user.id).await?;
|
||||||
|
|
||||||
|
// Delete their images
|
||||||
for upload in pictrs_uploads {
|
for upload in pictrs_uploads {
|
||||||
delete_image_from_pictrs(&upload.pictrs_alias, &upload.pictrs_delete_token, context)
|
delete_image_from_pictrs(&upload.pictrs_alias, &upload.pictrs_delete_token, context)
|
||||||
.await
|
.await
|
||||||
|
@ -779,7 +779,7 @@ pub async fn purge_user_account(
|
||||||
let person = Person::read(pool, person_id).await?;
|
let person = Person::read(pool, person_id).await?;
|
||||||
|
|
||||||
// Delete their local images, if they're a local user
|
// 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
|
// No need to update avatar and banner, those are handled in Person::delete_account
|
||||||
if let Some(avatar) = person.avatar {
|
if let Some(avatar) = person.avatar {
|
||||||
|
|
Loading…
Reference in a new issue