From: Dessalines Date: Mon, 23 Aug 2021 09:44:10 +0000 (-0400) Subject: Adding more site setup vars. Fixes #678 (#1718) X-Git-Url: http://these/git/%22https:/nerdica.net/%7B%24%7B%60data:application/static/%24%7B%60data:application/README.md?a=commitdiff_plain;h=1ee0c0c291384c760f4004f4f22f56c0e92ef41c;p=lemmy.git Adding more site setup vars. Fixes #678 (#1718) --- diff --git a/crates/api_crud/src/site/read.rs b/crates/api_crud/src/site/read.rs index cfbaf07a..0478109d 100644 --- a/crates/api_crud/src/site/read.rs +++ b/crates/api_crud/src/site/read.rs @@ -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); diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 2183fa31..f682a232 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -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); diff --git a/crates/utils/src/settings/structs.rs b/crates/utils/src/settings/structs.rs index c9537fe3..074cf87e 100644 --- a/crates/utils/src/settings/structs.rs +++ b/crates/utils/src/settings/structs.rs @@ -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, pub site_name: String, + #[default(None)] + pub admin_email: Option, + #[default(None)] + pub sidebar: Option, + #[default(None)] + pub description: Option, + #[default(None)] + pub icon: Option, + #[default(None)] + pub banner: Option, + #[default(None)] + pub enable_downvotes: Option, + #[default(None)] + pub open_registration: Option, + #[default(None)] + pub enable_nsfw: Option, + #[default(None)] + pub community_creation_admin_only: Option, } diff --git a/docker/federation/lemmy_alpha.hjson b/docker/federation/lemmy_alpha.hjson index 4819fb26..cb38aa8b 100644 --- a/docker/federation/lemmy_alpha.hjson +++ b/docker/federation/lemmy_alpha.hjson @@ -7,6 +7,7 @@ admin_username: lemmy_alpha admin_password: lemmy site_name: lemmy-alpha + sidebar: alphas sidebar } database: { database: lemmy