]> Untitled Git - lemmy.git/commitdiff
Add restricted community field to CreateCommunity, UpdateCommunity (ref #2235) (...
authorNutomic <me@nutomic.com>
Fri, 29 Apr 2022 14:01:10 +0000 (16:01 +0200)
committerGitHub <noreply@github.com>
Fri, 29 Apr 2022 14:01:10 +0000 (14:01 +0000)
crates/api_common/src/community.rs
crates/api_crud/src/community/create.rs
crates/api_crud/src/community/update.rs

index 4b9209d6af98e1d54f21ba4048443d22515a3d9d..49df41fae93a06144bab518d463d3e216dbba09a 100644 (file)
@@ -34,6 +34,7 @@ pub struct CreateCommunity {
   pub icon: Option<String>,
   pub banner: Option<String>,
   pub nsfw: Option<bool>,
+  pub posting_restricted_to_mods: Option<bool>,
   pub auth: Sensitive<String>,
 }
 
@@ -94,6 +95,7 @@ pub struct EditCommunity {
   pub icon: Option<String>,
   pub banner: Option<String>,
   pub nsfw: Option<bool>,
+  pub posting_restricted_to_mods: Option<bool>,
   pub auth: Sensitive<String>,
 }
 
index 27bce73e086b11a2857a5190bd5b94d6550eac5b..8d68d554d712daa8f61c9355cd3ae621eb7fb5a3 100644 (file)
@@ -103,6 +103,7 @@ impl PerformCrud for CreateCommunity {
       followers_url: Some(generate_followers_url(&community_actor_id)?),
       inbox_url: Some(generate_inbox_url(&community_actor_id)?),
       shared_inbox_url: Some(Some(generate_shared_inbox_url(&community_actor_id)?)),
+      posting_restricted_to_mods: data.posting_restricted_to_mods,
       ..CommunityForm::default()
     };
 
index 6a98180b4fa9f31bfd99521a3b66e0c4814a6fa8..4df708fcc8e803e1496fc77790e43d265a439eca 100644 (file)
@@ -64,6 +64,7 @@ impl PerformCrud for EditCommunity {
       icon,
       banner,
       nsfw: data.nsfw,
+      posting_restricted_to_mods: data.posting_restricted_to_mods,
       updated: Some(naive_now()),
       ..CommunityForm::default()
     };