Add shared channels related configuration under a E20 license check (#16415)
* Add shared channels related configuration under a E20 license check * Apply PR suggestions; Default config value for shared channels Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -60,7 +60,6 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
||||
} else {
|
||||
props["ExperimentalChannelOrganization"] = strconv.FormatBool(false)
|
||||
}
|
||||
props["ExperimentalSharedChannels"] = strconv.FormatBool(*c.ExperimentalSettings.EnableSharedChannels)
|
||||
|
||||
props["ExperimentalChannelSidebarOrganization"] = *c.ServiceSettings.ExperimentalChannelSidebarOrganization
|
||||
props["ExperimentalEnableAutomaticReplies"] = strconv.FormatBool(*c.TeamSettings.ExperimentalEnableAutomaticReplies)
|
||||
@@ -135,6 +134,7 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
||||
|
||||
props["CustomUrlSchemes"] = strings.Join(c.DisplaySettings.CustomUrlSchemes, ",")
|
||||
props["IsDefaultMarketplace"] = strconv.FormatBool(*c.PluginSettings.MarketplaceUrl == model.PLUGIN_SETTINGS_DEFAULT_MARKETPLACE_URL)
|
||||
props["ExperimentalSharedChannels"] = "false"
|
||||
|
||||
if license != nil {
|
||||
props["ExperimentalHideTownSquareinLHS"] = strconv.FormatBool(*c.TeamSettings.ExperimentalHideTownSquareinLHS)
|
||||
@@ -199,6 +199,10 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
||||
if *license.Features.Cloud {
|
||||
props["CWSUrl"] = *c.CloudSettings.CWSUrl
|
||||
}
|
||||
|
||||
if *license.Features.SharedChannels {
|
||||
props["ExperimentalSharedChannels"] = strconv.FormatBool(*c.ExperimentalSettings.EnableSharedChannels)
|
||||
}
|
||||
}
|
||||
|
||||
return props
|
||||
|
||||
@@ -84,6 +84,8 @@ type Features struct {
|
||||
EnterprisePlugins *bool `json:"enterprise_plugins"`
|
||||
AdvancedLogging *bool `json:"advanced_logging"`
|
||||
Cloud *bool `json:"cloud"`
|
||||
SharedChannels *bool `json:"shared_channels"`
|
||||
RemoteClusterService *bool `json:"remote_cluster_service"`
|
||||
|
||||
// after we enabled more features we'll need to control them with this
|
||||
FutureFeatures *bool `json:"future_features"`
|
||||
@@ -114,6 +116,8 @@ func (f *Features) ToMap() map[string]interface{} {
|
||||
"enterprise_plugins": *f.EnterprisePlugins,
|
||||
"advanced_logging": *f.AdvancedLogging,
|
||||
"cloud": *f.Cloud,
|
||||
"shared_channels": *f.SharedChannels,
|
||||
"remote_cluster_service": *f.RemoteClusterService,
|
||||
"future": *f.FutureFeatures,
|
||||
}
|
||||
}
|
||||
@@ -230,6 +234,14 @@ func (f *Features) SetDefaults() {
|
||||
if f.Cloud == nil {
|
||||
f.Cloud = NewBool(false)
|
||||
}
|
||||
|
||||
if f.SharedChannels == nil {
|
||||
f.SharedChannels = NewBool(false)
|
||||
}
|
||||
|
||||
if f.RemoteClusterService == nil {
|
||||
f.RemoteClusterService = f.SharedChannels
|
||||
}
|
||||
}
|
||||
|
||||
func (l *License) IsExpired() bool {
|
||||
|
||||
@@ -33,6 +33,8 @@ func TestLicenseFeaturesToMap(t *testing.T) {
|
||||
CheckTrue(t, m["custom_permissions_schemes"].(bool))
|
||||
CheckTrue(t, m["id_loaded"].(bool))
|
||||
CheckTrue(t, m["future"].(bool))
|
||||
CheckFalse(t, m["shared_channels"].(bool))
|
||||
CheckFalse(t, m["remote_cluster_service"].(bool))
|
||||
}
|
||||
|
||||
func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
@@ -57,6 +59,8 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
CheckTrue(t, *f.CustomPermissionsSchemes)
|
||||
CheckTrue(t, *f.GuestAccountsPermissions)
|
||||
CheckTrue(t, *f.IDLoadedPushNotifications)
|
||||
CheckFalse(t, *f.SharedChannels)
|
||||
CheckFalse(t, *f.RemoteClusterService)
|
||||
CheckTrue(t, *f.FutureFeatures)
|
||||
|
||||
f = Features{}
|
||||
@@ -82,6 +86,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
*f.GuestAccountsPermissions = true
|
||||
*f.EmailNotificationContents = true
|
||||
*f.IDLoadedPushNotifications = true
|
||||
*f.SharedChannels = true
|
||||
|
||||
f.SetDefaults()
|
||||
|
||||
@@ -104,6 +109,8 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
CheckTrue(t, *f.GuestAccounts)
|
||||
CheckTrue(t, *f.GuestAccountsPermissions)
|
||||
CheckTrue(t, *f.IDLoadedPushNotifications)
|
||||
CheckTrue(t, *f.SharedChannels)
|
||||
CheckTrue(t, *f.RemoteClusterService)
|
||||
CheckFalse(t, *f.FutureFeatures)
|
||||
}
|
||||
|
||||
@@ -188,6 +195,8 @@ func TestLicenseToFromJson(t *testing.T) {
|
||||
CheckBool(t, *f1.GuestAccounts, *f.GuestAccounts)
|
||||
CheckBool(t, *f1.GuestAccountsPermissions, *f.GuestAccountsPermissions)
|
||||
CheckBool(t, *f1.IDLoadedPushNotifications, *f.IDLoadedPushNotifications)
|
||||
CheckBool(t, *f1.SharedChannels, *f.SharedChannels)
|
||||
CheckBool(t, *f1.RemoteClusterService, *f.RemoteClusterService)
|
||||
CheckBool(t, *f1.FutureFeatures, *f.FutureFeatures)
|
||||
|
||||
invalid := `{"asdf`
|
||||
|
||||
@@ -160,6 +160,8 @@ func GetClientLicense(l *model.License) map[string]string {
|
||||
props["CustomTermsOfService"] = strconv.FormatBool(*l.Features.CustomTermsOfService)
|
||||
props["LockTeammateNameDisplay"] = strconv.FormatBool(*l.Features.LockTeammateNameDisplay)
|
||||
props["Cloud"] = strconv.FormatBool(*l.Features.Cloud)
|
||||
props["SharedChannels"] = strconv.FormatBool(*l.Features.SharedChannels)
|
||||
props["RemoteClusterService"] = strconv.FormatBool(*l.Features.RemoteClusterService)
|
||||
}
|
||||
|
||||
return props
|
||||
|
||||
Ссылка в новой задаче
Block a user