From ee3fae80bc1aa4b70709fbe3c89a6fbe40ca715a Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Tue, 25 Oct 2022 23:29:16 +0530 Subject: [PATCH] MM-47884: Migrate config state from focalboard plugin (#21490) Instead of blindly setting the initial flag value to false, we set it to the original plugin setting. https://mattermost.atlassian.net/browse/MM-47884 ```release-note NONE ``` --- model/config.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/model/config.go b/model/config.go index bccc3904a1..be7a88b61d 100644 --- a/model/config.go +++ b/model/config.go @@ -2751,9 +2751,13 @@ type ProductSettings struct { EnablePublicSharedBoards *bool } -func (s *ProductSettings) SetDefaults() { +func (s *ProductSettings) SetDefaults(plugins map[string]map[string]any) { if s.EnablePublicSharedBoards == nil { - s.EnablePublicSharedBoards = NewBool(false) + if p, ok := plugins[PluginIdFocalboard]; ok { + s.EnablePublicSharedBoards = NewBool(p["enablepublicsharedboards"].(bool)) + } else { + s.EnablePublicSharedBoards = NewBool(false) + } } } @@ -3246,7 +3250,7 @@ func (o *Config) SetDefaults() { o.ThemeSettings.SetDefaults() o.ClusterSettings.SetDefaults() o.PluginSettings.SetDefaults(o.LogSettings) - o.ProductSettings.SetDefaults() + o.ProductSettings.SetDefaults(o.PluginSettings.Plugins) o.AnalyticsSettings.SetDefaults() o.ComplianceSettings.SetDefaults() o.LocalizationSettings.SetDefaults()