Adding more site setup vars. Fixes #678 (#1718)

This commit is contained in:
Dessalines 2021-08-23 05:44:10 -04:00 committed by GitHub
parent 3b37ea6c8b
commit 1ee0c0c291
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 11 deletions

View 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);

View 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);

View 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>,
}

View File

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