]> Untitled Git - lemmy.git/commitdiff
In apub post receive, check posting restricted to mods (ref #2702) (#2704)
authorNutomic <me@nutomic.com>
Sun, 5 Feb 2023 17:31:09 +0000 (02:31 +0900)
committerGitHub <noreply@github.com>
Sun, 5 Feb 2023 17:31:09 +0000 (12:31 -0500)
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
crates/apub/src/objects/post.rs

index 2ef6401f51e1d0197ea096e3b0e73d087e5d7f07..33794344e718122168929f0a94fddfe56f592f58 100644 (file)
@@ -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()