Making sure remove post also checks higher mods or admins.

This commit is contained in:
Dessalines 2024-07-07 13:09:01 -04:00
parent ed0ecf6418
commit 2bade7f31f

View File

@ -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;