MM-44642 hide insights per license (#20490)
* MM-44642: Add a config key for Insights. * MM-44642: Includes feature flag in config key/value conditional. Adds tests. * MM-44642: Send the EnableCustomGroups and InsightsEnabled keys to unlicensed clients too. * MM-44642: Adds some tests for Custom Groups config setting.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
19d6fe40c2
Коммит
3703f943ec
@@ -129,6 +129,8 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
||||
props["IsDefaultMarketplace"] = strconv.FormatBool(*c.PluginSettings.MarketplaceURL == model.PluginSettingsDefaultMarketplaceURL)
|
||||
props["ExperimentalSharedChannels"] = "false"
|
||||
props["CollapsedThreads"] = *c.ServiceSettings.CollapsedThreads
|
||||
props["EnableCustomGroups"] = "false"
|
||||
props["InsightsEnabled"] = "false"
|
||||
|
||||
if license != nil {
|
||||
props["ExperimentalEnableAuthenticationTransfer"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableAuthenticationTransfer)
|
||||
@@ -203,6 +205,10 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
||||
if license.SkuShortName == model.LicenseShortSkuProfessional || license.SkuShortName == model.LicenseShortSkuEnterprise {
|
||||
props["EnableCustomGroups"] = strconv.FormatBool(*c.ServiceSettings.EnableCustomGroups)
|
||||
}
|
||||
|
||||
if (license.SkuShortName == model.LicenseShortSkuProfessional || license.SkuShortName == model.LicenseShortSkuEnterprise) && c.FeatureFlags.InsightsEnabled {
|
||||
props["InsightsEnabled"] = "true"
|
||||
}
|
||||
}
|
||||
|
||||
return props
|
||||
|
||||
@@ -150,6 +150,118 @@ func TestGetClientConfig(t *testing.T) {
|
||||
"ShowFullName": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
"Insights professional license",
|
||||
&model.Config{
|
||||
FeatureFlags: &model.FeatureFlags{
|
||||
InsightsEnabled: true,
|
||||
},
|
||||
},
|
||||
"",
|
||||
&model.License{
|
||||
Features: &model.Features{},
|
||||
SkuShortName: model.LicenseShortSkuProfessional,
|
||||
},
|
||||
map[string]string{
|
||||
"InsightsEnabled": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
"Insights enterprise license",
|
||||
&model.Config{
|
||||
FeatureFlags: &model.FeatureFlags{
|
||||
InsightsEnabled: true,
|
||||
},
|
||||
},
|
||||
"",
|
||||
&model.License{
|
||||
Features: &model.Features{},
|
||||
SkuShortName: model.LicenseShortSkuEnterprise,
|
||||
},
|
||||
map[string]string{
|
||||
"InsightsEnabled": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
"Insights other license",
|
||||
&model.Config{
|
||||
FeatureFlags: &model.FeatureFlags{
|
||||
InsightsEnabled: true,
|
||||
},
|
||||
},
|
||||
"",
|
||||
&model.License{
|
||||
Features: &model.Features{},
|
||||
SkuShortName: "other",
|
||||
},
|
||||
map[string]string{
|
||||
"InsightsEnabled": "false",
|
||||
},
|
||||
},
|
||||
{
|
||||
"Insights professional license, feature flag disabled",
|
||||
&model.Config{
|
||||
FeatureFlags: &model.FeatureFlags{
|
||||
InsightsEnabled: false,
|
||||
},
|
||||
},
|
||||
"",
|
||||
&model.License{
|
||||
Features: &model.Features{},
|
||||
SkuShortName: model.LicenseShortSkuProfessional,
|
||||
},
|
||||
map[string]string{
|
||||
"InsightsEnabled": "false",
|
||||
},
|
||||
},
|
||||
{
|
||||
"Custom groups professional license",
|
||||
&model.Config{
|
||||
FeatureFlags: &model.FeatureFlags{
|
||||
CustomGroups: true,
|
||||
},
|
||||
},
|
||||
"",
|
||||
&model.License{
|
||||
Features: &model.Features{},
|
||||
SkuShortName: model.LicenseShortSkuProfessional,
|
||||
},
|
||||
map[string]string{
|
||||
"EnableCustomGroups": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
"Custom groups enterprise license",
|
||||
&model.Config{
|
||||
FeatureFlags: &model.FeatureFlags{
|
||||
CustomGroups: true,
|
||||
},
|
||||
},
|
||||
"",
|
||||
&model.License{
|
||||
Features: &model.Features{},
|
||||
SkuShortName: model.LicenseShortSkuEnterprise,
|
||||
},
|
||||
map[string]string{
|
||||
"EnableCustomGroups": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
"Custom groups other license",
|
||||
&model.Config{
|
||||
FeatureFlags: &model.FeatureFlags{
|
||||
InsightsEnabled: true,
|
||||
},
|
||||
},
|
||||
"",
|
||||
&model.License{
|
||||
Features: &model.Features{},
|
||||
SkuShortName: "other",
|
||||
},
|
||||
map[string]string{
|
||||
"EnableCustomGroups": "false",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
||||
Ссылка в новой задаче
Block a user