diff options
author | David Meza <dmeza@users.noreply.github.com> | 2017-09-05 19:28:46 -0500 |
---|---|---|
committer | Chris <ccbrown112@gmail.com> | 2017-09-05 19:28:46 -0500 |
commit | 1605fa5102e7d5d76a02456130097d3ab82c2a2b (patch) | |
tree | 9ac27174b4eff176d3b466acbb036d1fa52b96e3 /model | |
parent | 7cee7b3342afa4b6845b0574f90c9fdc586c3c34 (diff) | |
download | chat-1605fa5102e7d5d76a02456130097d3ab82c2a2b.tar.gz chat-1605fa5102e7d5d76a02456130097d3ab82c2a2b.tar.bz2 chat-1605fa5102e7d5d76a02456130097d3ab82c2a2b.zip |
Configs for themes in `Display Settings`: hide themes options, hide custom themes, specific list of themes (#7173)
* Add configuration to enable or disable choosing themes in Display Settings. Only for Licensed servers.
* Add configuration to enable or disable choosing custom themes in Display Settings. Only for Licensed servers.
* Add configuration to enable or disable a specific list of themes to choose in Display Settings. Only for Licensed servers.
* Added config value and logic for "DefaultTheme"
* Fix problem with undefined values when the server is not licensed
Diffstat (limited to 'model')
-rw-r--r-- | model/config.go | 29 | ||||
-rw-r--r-- | model/license.go | 6 |
2 files changed, 35 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go index c6fd84ed0..38e09d216 100644 --- a/model/config.go +++ b/model/config.go @@ -132,6 +132,8 @@ const ( ANNOUNCEMENT_SETTINGS_DEFAULT_BANNER_COLOR = "#f2a93b" ANNOUNCEMENT_SETTINGS_DEFAULT_BANNER_TEXT_COLOR = "#333333" + TEAM_SETTINGS_DEFAULT_TEAM_TEXT = "default" + ELASTICSEARCH_SETTINGS_DEFAULT_CONNECTION_URL = "" ELASTICSEARCH_SETTINGS_DEFAULT_USERNAME = "" ELASTICSEARCH_SETTINGS_DEFAULT_PASSWORD = "" @@ -335,6 +337,13 @@ type AnnouncementSettings struct { AllowBannerDismissal *bool } +type ThemeSettings struct { + EnableThemeSelection *bool + DefaultTheme *string + AllowCustomThemes *bool + AllowedThemes []string +} + type TeamSettings struct { SiteName string MaxUsersPerTeam *int @@ -500,6 +509,7 @@ type Config struct { PrivacySettings PrivacySettings SupportSettings SupportSettings AnnouncementSettings AnnouncementSettings + ThemeSettings ThemeSettings GitLabSettings SSOSettings GoogleSettings SSOSettings Office365Settings SSOSettings @@ -1003,6 +1013,25 @@ func (o *Config) SetDefaults() { *o.AnnouncementSettings.AllowBannerDismissal = true } + if o.ThemeSettings.EnableThemeSelection == nil { + o.ThemeSettings.EnableThemeSelection = new(bool) + *o.ThemeSettings.EnableThemeSelection = true + } + + if o.ThemeSettings.DefaultTheme == nil { + o.ThemeSettings.DefaultTheme = new(string) + *o.ThemeSettings.DefaultTheme = TEAM_SETTINGS_DEFAULT_TEAM_TEXT + } + + if o.ThemeSettings.AllowCustomThemes == nil { + o.ThemeSettings.AllowCustomThemes = new(bool) + *o.ThemeSettings.AllowCustomThemes = true + } + + if o.ThemeSettings.AllowedThemes == nil { + o.ThemeSettings.AllowedThemes = []string{} + } + if o.LdapSettings.Enable == nil { o.LdapSettings.Enable = new(bool) *o.LdapSettings.Enable = false diff --git a/model/license.go b/model/license.go index ea1089723..d6fbcb937 100644 --- a/model/license.go +++ b/model/license.go @@ -51,6 +51,7 @@ type Features struct { PasswordRequirements *bool `json:"password_requirements"` Elasticsearch *bool `json:"elastic_search"` Announcement *bool `json:"announcement"` + ThemeManagement *bool `json:"theme_management"` EmailNotificationContents *bool `json:"email_notification_contents"` // after we enabled more features for webrtc we'll need to control them with this @@ -152,6 +153,11 @@ func (f *Features) SetDefaults() { *f.Announcement = true } + if f.ThemeManagement == nil { + f.ThemeManagement = new(bool) + *f.ThemeManagement = true + } + if f.EmailNotificationContents == nil { f.EmailNotificationContents = new(bool) *f.EmailNotificationContents = *f.FutureFeatures |