From 7c1a37d5843d161fb26fdc3c7c40cddead2775d7 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Mon, 6 Feb 2023 02:31:09 +0900 Subject: [PATCH] In apub post receive, check posting restricted to mods (ref #2702) (#2704) Co-authored-by: Dessalines --- crates/apub/src/objects/post.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index 2ef6401f..33794344 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -26,7 +26,7 @@ use chrono::NaiveDateTime; use lemmy_api_common::{ context::LemmyContext, request::fetch_site_data, - utils::local_site_opt_to_slur_regex, + utils::{is_mod_or_admin, local_site_opt_to_slur_regex}, }; use lemmy_db_schema::{ self, @@ -173,6 +173,9 @@ impl ApubObject for ApubPost { .dereference(context, local_instance(context).await, request_counter) .await?; let community = page.community(context, request_counter).await?; + if community.posting_restricted_to_mods { + is_mod_or_admin(context.pool(), creator.id, community.id).await?; + } let mut name = page .name .clone() -- 2.44.1