]> Untitled Git - lemmy.git/commitdiff
Adding more site setup vars. Fixes #678 (#1718)
authorDessalines <dessalines@users.noreply.github.com>
Mon, 23 Aug 2021 09:44:10 +0000 (05:44 -0400)
committerGitHub <noreply@github.com>
Mon, 23 Aug 2021 09:44:10 +0000 (09:44 +0000)
crates/api_crud/src/site/read.rs
crates/db_views/src/comment_view.rs
crates/utils/src/settings/structs.rs
docker/federation/lemmy_alpha.hjson

index cfbaf07a5a9135a01467ab4fe719d59796f1fe6a..0478109dc9fff3f466a9c577bc78162bb55a6c2d 100644 (file)
@@ -49,15 +49,15 @@ impl PerformCrud for GetSite {
 
           let create_site = CreateSite {
             name: setup.site_name.to_owned(),
-            sidebar: None,
-            description: None,
-            icon: None,
-            banner: None,
-            enable_downvotes: None,
-            open_registration: None,
-            enable_nsfw: None,
+            sidebar: setup.sidebar.to_owned(),
+            description: setup.description.to_owned(),
+            icon: setup.icon.to_owned(),
+            banner: setup.banner.to_owned(),
+            enable_downvotes: setup.enable_downvotes,
+            open_registration: setup.open_registration,
+            enable_nsfw: setup.enable_nsfw,
+            community_creation_admin_only: setup.community_creation_admin_only,
             auth: login_response.jwt,
-            community_creation_admin_only: None,
           };
           create_site.perform(context, websocket_id).await?;
           info!("Site {} created", setup.site_name);
index 2183fa31e53df692562b165d92a39453de65fa20..f682a232cd091ade860afe589dcf61ca2bd82706 100644 (file)
@@ -708,7 +708,7 @@ mod tests {
     );
 
     // Make sure block set the creator blocked
-    assert_eq!(true, read_comment_from_blocked_person.creator_blocked);
+    assert!(read_comment_from_blocked_person.creator_blocked);
 
     assert_eq!(1, num_deleted);
     assert_eq!(1, like_removed);
index c9537fe36f7a549a0d8243a481785a17495f2fe5..074cf87e8114836ef82196c11957639e79761f92 100644 (file)
@@ -103,10 +103,27 @@ pub struct RateLimitConfig {
   pub image_per_second: i32,
 }
 
-#[derive(Debug, Deserialize, Clone)]
+#[derive(Debug, Deserialize, Clone, SmartDefault)]
 pub struct SetupConfig {
   pub admin_username: String,
   pub admin_password: String,
-  pub admin_email: Option<String>,
   pub site_name: String,
+  #[default(None)]
+  pub admin_email: Option<String>,
+  #[default(None)]
+  pub sidebar: Option<String>,
+  #[default(None)]
+  pub description: Option<String>,
+  #[default(None)]
+  pub icon: Option<String>,
+  #[default(None)]
+  pub banner: Option<String>,
+  #[default(None)]
+  pub enable_downvotes: Option<bool>,
+  #[default(None)]
+  pub open_registration: Option<bool>,
+  #[default(None)]
+  pub enable_nsfw: Option<bool>,
+  #[default(None)]
+  pub community_creation_admin_only: Option<bool>,
 }
index 4819fb26abdef556526988607ab75534a298312b..cb38aa8b65efed3ac69e0f18d52b336465d22842 100644 (file)
@@ -7,6 +7,7 @@
     admin_username: lemmy_alpha
     admin_password: lemmy
     site_name: lemmy-alpha
+    sidebar: alphas sidebar
   }
   database: {
     database: lemmy