|
|
|
@ -4,7 +4,7 @@ use lemmy_api_common::{
|
|
|
|
|
context::LemmyContext,
|
|
|
|
|
request::purge_image_from_pictrs,
|
|
|
|
|
site::{PurgeItemResponse, PurgePerson},
|
|
|
|
|
utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_person},
|
|
|
|
|
utils::{get_local_user_view_from_jwt, is_top_admin, purge_image_posts_for_person},
|
|
|
|
|
};
|
|
|
|
|
use lemmy_db_schema::{
|
|
|
|
|
source::{
|
|
|
|
@ -29,8 +29,8 @@ impl Perform for PurgePerson {
|
|
|
|
|
let local_user_view =
|
|
|
|
|
get_local_user_view_from_jwt(&data.auth, context.pool(), context.secret()).await?;
|
|
|
|
|
|
|
|
|
|
// Only let admins purge an item
|
|
|
|
|
is_admin(&local_user_view)?;
|
|
|
|
|
// Only let the top admin purge an item
|
|
|
|
|
is_top_admin(context.pool(), local_user_view.person.id).await?;
|
|
|
|
|
|
|
|
|
|
// Read the person to get their images
|
|
|
|
|
let person_id = data.person_id;
|
|
|
|
|