From: Nutomic Date: Sun, 5 Feb 2023 17:31:09 +0000 (+0900) Subject: In apub post receive, check posting restricted to mods (ref #2702) (#2704) X-Git-Url: http://these/git/%7B%60%24%7Bdocument.location.origin%7D/feeds/readmes/%7Bicon?a=commitdiff_plain;h=7c1a37d5843d161fb26fdc3c7c40cddead2775d7;p=lemmy.git In apub post receive, check posting restricted to mods (ref #2702) (#2704) Co-authored-by: Dessalines --- 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()