From 93174fbe56f3d3dd16b97c84656c4a46305f31cd Mon Sep 17 00:00:00 2001 From: Kyriakos Z <3829551+koox00@users.noreply.github.com> Date: Sun, 11 Sep 2022 20:45:20 +0300 Subject: [PATCH] MM-46408: adds PostPriority feature flag and admin setting (#20875) * MM-46408: adds PostPriority feature flag Adds the PostPriority feature flag. You can enable it by setting the env variable `MM_FEATUREFLAGS_POSTPRIORITY=true`. * Adds support for admin setting * empty * Uses post priority in telemetry Co-authored-by: Mattermod --- config/client.go | 1 + model/config.go | 5 +++++ model/feature_flags.go | 3 +++ services/telemetry/telemetry.go | 1 + 4 files changed, 10 insertions(+) diff --git a/config/client.go b/config/client.go index c8e9eedc52..7315ab6898 100644 --- a/config/client.go +++ b/config/client.go @@ -131,6 +131,7 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li props["CollapsedThreads"] = *c.ServiceSettings.CollapsedThreads props["EnableCustomGroups"] = "false" props["InsightsEnabled"] = "false" + props["PostPriority"] = strconv.FormatBool(*c.ServiceSettings.PostPriority) if license != nil { props["ExperimentalEnableAuthenticationTransfer"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableAuthenticationTransfer) diff --git a/model/config.go b/model/config.go index b117548a67..967cff1dc8 100644 --- a/model/config.go +++ b/model/config.go @@ -371,6 +371,7 @@ type ServiceSettings struct { EnableSVGs *bool `access:"site_posts"` EnableLatex *bool `access:"site_posts"` EnableInlineLatex *bool `access:"site_posts"` + PostPriority *bool `access:"site_posts"` EnableAPIChannelDeletion *bool EnableLocalMode *bool LocalModeSocketLocation *string // telemetry: none @@ -842,6 +843,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { if s.EnableCustomGroups == nil { s.EnableCustomGroups = NewBool(true) } + + if s.PostPriority == nil { + s.PostPriority = NewBool(false) + } } type ClusterSettings struct { diff --git a/model/feature_flags.go b/model/feature_flags.go index 257b6e1a6d..209e7a9f99 100644 --- a/model/feature_flags.go +++ b/model/feature_flags.go @@ -73,6 +73,8 @@ type FeatureFlags struct { BoardsProduct bool PlanUpgradeButtonText string + + PostPriority bool } func (f *FeatureFlags) SetDefaults() { @@ -100,6 +102,7 @@ func (f *FeatureFlags) SetDefaults() { f.CallsEnabled = true f.BoardsProduct = false f.PlanUpgradeButtonText = "upgrade" + f.PostPriority = false } func (f *FeatureFlags) Plugins() map[string]string { diff --git a/services/telemetry/telemetry.go b/services/telemetry/telemetry.go index fc58db9005..3168f61e35 100644 --- a/services/telemetry/telemetry.go +++ b/services/telemetry/telemetry.go @@ -448,6 +448,7 @@ func (ts *TelemetryService) trackConfig() { "enable_file_search": *cfg.ServiceSettings.EnableFileSearch, "restrict_link_previews": isDefault(*cfg.ServiceSettings.RestrictLinkPreviews, ""), "enable_custom_groups": *cfg.ServiceSettings.EnableCustomGroups, + "post_priority": *cfg.ServiceSettings.PostPriority, }) ts.SendTelemetry(TrackConfigTeam, map[string]any{