Adding more site setup vars. Fixes #678

This commit is contained in:
Dessalines 2021-08-21 16:40:28 -04:00
parent 3b37ea6c8b
commit 3a2616478c
4 changed files with 29 additions and 11 deletions

View file

@ -49,15 +49,15 @@ impl PerformCrud for GetSite {
let create_site = CreateSite { let create_site = CreateSite {
name: setup.site_name.to_owned(), name: setup.site_name.to_owned(),
sidebar: None, sidebar: setup.sidebar.to_owned(),
description: None, description: setup.description.to_owned(),
icon: None, icon: setup.icon.to_owned(),
banner: None, banner: setup.banner.to_owned(),
enable_downvotes: None, enable_downvotes: setup.enable_downvotes,
open_registration: None, open_registration: setup.open_registration,
enable_nsfw: None, enable_nsfw: setup.enable_nsfw,
community_creation_admin_only: setup.community_creation_admin_only,
auth: login_response.jwt, auth: login_response.jwt,
community_creation_admin_only: None,
}; };
create_site.perform(context, websocket_id).await?; create_site.perform(context, websocket_id).await?;
info!("Site {} created", setup.site_name); info!("Site {} created", setup.site_name);

View file

@ -708,7 +708,7 @@ mod tests {
); );
// Make sure block set the creator blocked // 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, num_deleted);
assert_eq!(1, like_removed); assert_eq!(1, like_removed);

View file

@ -103,10 +103,27 @@ pub struct RateLimitConfig {
pub image_per_second: i32, pub image_per_second: i32,
} }
#[derive(Debug, Deserialize, Clone)] #[derive(Debug, Deserialize, Clone, SmartDefault)]
pub struct SetupConfig { pub struct SetupConfig {
pub admin_username: String, pub admin_username: String,
pub admin_password: String, pub admin_password: String,
pub admin_email: Option<String>,
pub site_name: 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>,
} }

View file

@ -7,6 +7,7 @@
admin_username: lemmy_alpha admin_username: lemmy_alpha
admin_password: lemmy admin_password: lemmy
site_name: lemmy-alpha site_name: lemmy-alpha
sidebar: alphas sidebar
} }
database: { database: {
database: lemmy database: lemmy