Renamed premium SKU to Enterprise Advanced (#30882)

Этот коммит содержится в:
Harshil Sharma
2025-05-02 11:34:46 +05:30
коммит произвёл GitHub
родитель e1f47e22e7
Коммит a76c063d85
16 изменённых файлов: 66 добавлений и 66 удалений

Просмотреть файл

@@ -2460,7 +2460,7 @@ func convertGroupMessageToChannel(c *Context, w http.ResponseWriter, r *http.Req
}
func canEditChannelBanner(license *model.License, originalChannel *model.Channel) *model.AppError {
if !model.MinimumPremiumLicense(license) {
if !model.MinimumEnterpriseAdvancedLicense(license) {
return model.NewAppError("", "license_error.feature_unavailable.specific", map[string]any{"Feature": "Channel Banner"}, "feature is not available for the current license", http.StatusForbidden)
}

Просмотреть файл

@@ -810,7 +810,7 @@ func TestPatchChannel(t *testing.T) {
t.Run("Should be able to configure channel banner on a channel", func(t *testing.T) {
client.Logout(context.Background())
th.LoginBasic()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium))
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
defer func() {
th.App.Srv().RemoveLicense()
}()
@@ -845,7 +845,7 @@ func TestPatchChannel(t *testing.T) {
t.Run("Cannot enable channel banner without configuring it", func(t *testing.T) {
client.Logout(context.Background())
th.LoginBasic()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium))
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
defer func() {
th.App.Srv().RemoveLicense()
}()
@@ -905,7 +905,7 @@ func TestPatchChannel(t *testing.T) {
t.Run("Cannot configure channel banner on a DM channel", func(t *testing.T) {
client.Logout(context.Background())
th.LoginBasic()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium))
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
defer func() {
th.App.Srv().RemoveLicense()
}()
@@ -932,7 +932,7 @@ func TestPatchChannel(t *testing.T) {
t.Run("Cannot configure channel banner on a GM channel", func(t *testing.T) {
client.Logout(context.Background())
th.LoginBasic()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium))
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
defer func() {
th.App.Srv().RemoveLicense()
}()
@@ -5765,7 +5765,7 @@ func TestCanEditChannelBanner(t *testing.T) {
})
t.Run("when channel type is direct message", func(t *testing.T) {
license := model.NewTestLicenseSKU(model.LicenseShortSkuPremium)
license := model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced)
channel := &model.Channel{
Type: model.ChannelTypeDirect,
}
@@ -5778,7 +5778,7 @@ func TestCanEditChannelBanner(t *testing.T) {
})
t.Run("when channel type is group message", func(t *testing.T) {
license := model.NewTestLicenseSKU(model.LicenseShortSkuPremium)
license := model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced)
channel := &model.Channel{
Type: model.ChannelTypeGroup,
}
@@ -5790,7 +5790,7 @@ func TestCanEditChannelBanner(t *testing.T) {
})
t.Run("when channel type is open and license is valid", func(t *testing.T) {
license := model.NewTestLicenseSKU(model.LicenseShortSkuPremium)
license := model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced)
channel := &model.Channel{
Type: model.ChannelTypeOpen,
}
@@ -5800,7 +5800,7 @@ func TestCanEditChannelBanner(t *testing.T) {
})
t.Run("when channel type is private and license is valid", func(t *testing.T) {
license := model.NewTestLicenseSKU(model.LicenseShortSkuPremium)
license := model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced)
channel := &model.Channel{
Type: model.ChannelTypePrivate,
}

Просмотреть файл

@@ -97,9 +97,9 @@ const (
type TrackSKU string
const (
TrackProfessionalSKU TrackSKU = "professional"
TrackEnterpriseSKU TrackSKU = "enterprise"
TrackPremiumSKU TrackSKU = "premium"
TrackProfessionalSKU TrackSKU = "professional"
TrackEnterpriseSKU TrackSKU = "enterprise"
TrackEnterpriseAdvancedSKU TrackSKU = "advanced"
)
type TrackFeature string

Просмотреть файл

@@ -19,21 +19,21 @@ const (
LicenseGracePeriod = DayInMilliseconds * 10 //10 days
LicenseRenewalLink = "https://mattermost.com/renew/"
LicenseShortSkuE10 = "E10"
LicenseShortSkuE20 = "E20"
LicenseShortSkuProfessional = "professional"
LicenseShortSkuEnterprise = "enterprise"
LicenseShortSkuPremium = "premium"
LicenseShortSkuE10 = "E10"
LicenseShortSkuE20 = "E20"
LicenseShortSkuProfessional = "professional"
LicenseShortSkuEnterprise = "enterprise"
LicenseShortSkuEnterpriseAdvanced = "advanced"
ProfessionalTier = 10
EnterpriseTier = 20
PremiumTier = 30
ProfessionalTier = 10
EnterpriseTier = 20
EnterpriseAdvancedTier = 30
)
var LicenseToLicenseTier = map[string]int{
LicenseShortSkuProfessional: ProfessionalTier,
LicenseShortSkuEnterprise: EnterpriseTier,
LicenseShortSkuPremium: PremiumTier,
LicenseShortSkuProfessional: ProfessionalTier,
LicenseShortSkuEnterprise: EnterpriseTier,
LicenseShortSkuEnterpriseAdvanced: EnterpriseAdvancedTier,
}
const (
@@ -474,7 +474,7 @@ func MinimumEnterpriseLicense(license *License) bool {
return license != nil && LicenseToLicenseTier[license.SkuShortName] >= EnterpriseTier
}
// MinimumPremiumLicense returns true if the provided license is at least a premium license.
func MinimumPremiumLicense(license *License) bool {
return license != nil && LicenseToLicenseTier[license.SkuShortName] >= PremiumTier
// MinimumEnterpriseAdvancedLicense returns true if the provided license is at least an Enterprise Advanced license.
func MinimumEnterpriseAdvancedLicense(license *License) bool {
return license != nil && LicenseToLicenseTier[license.SkuShortName] >= EnterpriseAdvancedTier
}

Просмотреть файл

@@ -512,9 +512,9 @@ func TestMinimumProfessionalLicense(t *testing.T) {
true,
},
{
"premium license",
"enterprise advanced license",
&License{
SkuShortName: LicenseShortSkuPremium,
SkuShortName: LicenseShortSkuEnterpriseAdvanced,
},
true,
},
@@ -574,9 +574,9 @@ func TestMinimumEnterpriseLicense(t *testing.T) {
true,
},
{
"premium license",
"enterprise advanced license",
&License{
SkuShortName: LicenseShortSkuPremium,
SkuShortName: LicenseShortSkuEnterpriseAdvanced,
},
true,
},
@@ -610,7 +610,7 @@ func TestMinimumEnterpriseLicense(t *testing.T) {
}
}
func TestMinimumPremiumLicense(t *testing.T) {
func TestMinimumEnterpriseAdvancedLicense(t *testing.T) {
testCases := []struct {
description string
license *License
@@ -636,9 +636,9 @@ func TestMinimumPremiumLicense(t *testing.T) {
false,
},
{
"premium license",
"enterprise advanced license",
&License{
SkuShortName: LicenseShortSkuPremium,
SkuShortName: LicenseShortSkuEnterpriseAdvanced,
},
true,
},
@@ -667,7 +667,7 @@ func TestMinimumPremiumLicense(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.description, func(t *testing.T) {
assert.Equal(t, testCase.expectedValue, MinimumPremiumLicense(testCase.license))
assert.Equal(t, testCase.expectedValue, MinimumEnterpriseAdvancedLicense(testCase.license))
})
}
}

Просмотреть файл

@@ -23,7 +23,7 @@ func isValidSkuShortName(license *model.License) bool {
}
switch license.SkuShortName {
case model.LicenseShortSkuE10, model.LicenseShortSkuE20, model.LicenseShortSkuProfessional, model.LicenseShortSkuEnterprise, model.LicenseShortSkuPremium:
case model.LicenseShortSkuE10, model.LicenseShortSkuE20, model.LicenseShortSkuProfessional, model.LicenseShortSkuEnterprise, model.LicenseShortSkuEnterpriseAdvanced:
return true
default:
return false
@@ -74,10 +74,10 @@ func IsE20LicensedOrDevelopment(config *model.Config, license *model.License) bo
return IsConfiguredForDevelopment(config)
}
// IsPremiumLicensedOrDevelopment returns true when the server is licensed with a Mattermost
// Premium License, or has `EnableDeveloper` and `EnableTesting` configuration settings
func IsPremiumLicensedOrDevelopment(config *model.Config, license *model.License) bool {
if license != nil && license.SkuShortName == model.LicenseShortSkuPremium {
// IsEnterpriseAdvancedLicensedOrDevelopment returns true when the server is licensed with a Mattermost
// Enterprise Advanced License, or has `EnableDeveloper` and `EnableTesting` configuration settings
func IsEnterpriseAdvancedLicensedOrDevelopment(config *model.Config, license *model.License) bool {
if license != nil && license.SkuShortName == model.LicenseShortSkuEnterpriseAdvanced {
return true
}

Просмотреть файл

@@ -285,82 +285,82 @@ func TestIsValidSKUShortName(t *testing.T) {
})
}
func TestIsPremiumOrDevelopment(t *testing.T) {
func TestIsEnterpriseAdvancedOrDevelopment(t *testing.T) {
t.Run("nil license features", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, &model.License{}))
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, &model.License{}))
})
t.Run("nil future features", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, &model.License{Features: &model.Features{}}))
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, &model.License{Features: &model.Features{}}))
})
t.Run("disabled future features", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, &model.License{Features: &model.Features{
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, &model.License{Features: &model.Features{
FutureFeatures: bToP(false),
}}))
})
t.Run("should have no affect of future features", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, &model.License{Features: &model.Features{
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, &model.License{Features: &model.Features{
FutureFeatures: bToP(true),
}}))
})
t.Run("no license, no config", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, nil))
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, nil))
})
t.Run("no license, nil config", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(
&model.Config{ServiceSettings: model.ServiceSettings{EnableDeveloper: nil, EnableTesting: nil}},
nil,
))
})
t.Run("no license, only developer mode", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(
&model.Config{ServiceSettings: model.ServiceSettings{EnableDeveloper: bToP(true), EnableTesting: bToP(false)}},
nil,
))
})
t.Run("no license, only testing mode", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(
&model.Config{ServiceSettings: model.ServiceSettings{EnableDeveloper: bToP(false), EnableTesting: bToP(true)}},
nil,
))
})
t.Run("no license, developer and testing mode", func(t *testing.T) {
assert.True(t, IsPremiumLicensedOrDevelopment(
assert.True(t, IsEnterpriseAdvancedLicensedOrDevelopment(
&model.Config{ServiceSettings: model.ServiceSettings{EnableDeveloper: bToP(true), EnableTesting: bToP(true)}},
nil,
))
})
t.Run("license with E10 SKU name, disabled future features", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, &model.License{
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, &model.License{
SkuShortName: "E10",
Features: &model.Features{FutureFeatures: bToP(false)},
}))
})
t.Run("license with E10 SKU name, enabled future features", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, &model.License{
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, &model.License{
SkuShortName: "E10",
Features: &model.Features{FutureFeatures: bToP(true)},
}))
})
t.Run("license with E20 SKU name, disabled future features", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, &model.License{
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, &model.License{
SkuShortName: "E20",
Features: &model.Features{FutureFeatures: bToP(false)},
}))
})
t.Run("license with E20 SKU name, enabled future features", func(t *testing.T) {
assert.False(t, IsPremiumLicensedOrDevelopment(nil, &model.License{
assert.False(t, IsEnterpriseAdvancedLicensedOrDevelopment(nil, &model.License{
SkuShortName: "E20",
Features: &model.Features{FutureFeatures: bToP(true)},
}))