From 2bade7f31f9131b0a1cf1362f32f01d4c2ae829f Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 7 Jul 2024 13:09:01 -0400 Subject: [PATCH] Making sure remove post also checks higher mods or admins. --- crates/api_crud/src/post/remove.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/api_crud/src/post/remove.rs b/crates/api_crud/src/post/remove.rs index 682ed75d3..78e4560ce 100644 --- a/crates/api_crud/src/post/remove.rs +++ b/crates/api_crud/src/post/remove.rs @@ -5,7 +5,7 @@ use lemmy_api_common::{ context::LemmyContext, post::{PostResponse, RemovePost}, send_activity::{ActivityChannel, SendActivityData}, - utils::check_community_mod_action, + utils::{check_community_mod_action, check_is_higher_mod_or_admin}, }; use lemmy_db_schema::{ source::{ @@ -37,6 +37,14 @@ pub async fn remove_post( ) .await?; + check_is_higher_mod_or_admin( + &mut context.pool(), + &local_user_view, + orig_post.community_id, + &[orig_post.creator_id], + ) + .await?; + // Update the post let post_id = data.post_id; let removed = data.removed;