Renamed premium SKU to Enterprise Advanced (#30882)

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

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

@@ -7,7 +7,7 @@ import {getRandomId} from 'utils/utils';
test('Should show channel banner when configured', async ({pw}) => { test('Should show channel banner when configured', async ({pw}) => {
const {adminUser, adminClient} = await pw.initSetup(); const {adminUser, adminClient} = await pw.initSetup();
const license = await adminClient.getClientLicenseOld(); const license = await adminClient.getClientLicenseOld();
test.skip(license.SkuShortName !== 'premium', 'Skipping test - server does not have Premium license'); test.skip(license.SkuShortName !== 'advanced', 'Skipping test - server does not have Enterprise Advanced license');
const {channelsPage} = await pw.testBrowser.login(adminUser); const {channelsPage} = await pw.testBrowser.login(adminUser);
await channelsPage.goto(); await channelsPage.goto();
@@ -52,7 +52,7 @@ test('Should show channel banner when configured', async ({pw}) => {
test('Should render markdown', async ({pw}) => { test('Should render markdown', async ({pw}) => {
const {adminUser, adminClient} = await pw.initSetup(); const {adminUser, adminClient} = await pw.initSetup();
const license = await adminClient.getClientLicenseOld(); const license = await adminClient.getClientLicenseOld();
test.skip(license.SkuShortName !== 'premium', 'Skipping test - server does not have Premium license'); test.skip(license.SkuShortName !== 'advanced', 'Skipping test - server does not have Enterprise Advanced license');
const {channelsPage} = await pw.testBrowser.login(adminUser); const {channelsPage} = await pw.testBrowser.login(adminUser);
await channelsPage.goto(); await channelsPage.goto();

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

@@ -2460,7 +2460,7 @@ func convertGroupMessageToChannel(c *Context, w http.ResponseWriter, r *http.Req
} }
func canEditChannelBanner(license *model.License, originalChannel *model.Channel) *model.AppError { 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) 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) { t.Run("Should be able to configure channel banner on a channel", func(t *testing.T) {
client.Logout(context.Background()) client.Logout(context.Background())
th.LoginBasic() th.LoginBasic()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium)) th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
defer func() { defer func() {
th.App.Srv().RemoveLicense() 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) { t.Run("Cannot enable channel banner without configuring it", func(t *testing.T) {
client.Logout(context.Background()) client.Logout(context.Background())
th.LoginBasic() th.LoginBasic()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium)) th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
defer func() { defer func() {
th.App.Srv().RemoveLicense() 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) { t.Run("Cannot configure channel banner on a DM channel", func(t *testing.T) {
client.Logout(context.Background()) client.Logout(context.Background())
th.LoginBasic() th.LoginBasic()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium)) th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
defer func() { defer func() {
th.App.Srv().RemoveLicense() 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) { t.Run("Cannot configure channel banner on a GM channel", func(t *testing.T) {
client.Logout(context.Background()) client.Logout(context.Background())
th.LoginBasic() th.LoginBasic()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium)) th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
defer func() { defer func() {
th.App.Srv().RemoveLicense() 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) { 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{ channel := &model.Channel{
Type: model.ChannelTypeDirect, Type: model.ChannelTypeDirect,
} }
@@ -5778,7 +5778,7 @@ func TestCanEditChannelBanner(t *testing.T) {
}) })
t.Run("when channel type is group message", func(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{ channel := &model.Channel{
Type: model.ChannelTypeGroup, 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) { 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{ channel := &model.Channel{
Type: model.ChannelTypeOpen, 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) { 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{ channel := &model.Channel{
Type: model.ChannelTypePrivate, Type: model.ChannelTypePrivate,
} }

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

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

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

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

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

@@ -512,9 +512,9 @@ func TestMinimumProfessionalLicense(t *testing.T) {
true, true,
}, },
{ {
"premium license", "enterprise advanced license",
&License{ &License{
SkuShortName: LicenseShortSkuPremium, SkuShortName: LicenseShortSkuEnterpriseAdvanced,
}, },
true, true,
}, },
@@ -574,9 +574,9 @@ func TestMinimumEnterpriseLicense(t *testing.T) {
true, true,
}, },
{ {
"premium license", "enterprise advanced license",
&License{ &License{
SkuShortName: LicenseShortSkuPremium, SkuShortName: LicenseShortSkuEnterpriseAdvanced,
}, },
true, true,
}, },
@@ -610,7 +610,7 @@ func TestMinimumEnterpriseLicense(t *testing.T) {
} }
} }
func TestMinimumPremiumLicense(t *testing.T) { func TestMinimumEnterpriseAdvancedLicense(t *testing.T) {
testCases := []struct { testCases := []struct {
description string description string
license *License license *License
@@ -636,9 +636,9 @@ func TestMinimumPremiumLicense(t *testing.T) {
false, false,
}, },
{ {
"premium license", "enterprise advanced license",
&License{ &License{
SkuShortName: LicenseShortSkuPremium, SkuShortName: LicenseShortSkuEnterpriseAdvanced,
}, },
true, true,
}, },
@@ -667,7 +667,7 @@ func TestMinimumPremiumLicense(t *testing.T) {
for _, testCase := range testCases { for _, testCase := range testCases {
t.Run(testCase.description, func(t *testing.T) { 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 { 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 return true
default: default:
return false return false
@@ -74,10 +74,10 @@ func IsE20LicensedOrDevelopment(config *model.Config, license *model.License) bo
return IsConfiguredForDevelopment(config) return IsConfiguredForDevelopment(config)
} }
// IsPremiumLicensedOrDevelopment returns true when the server is licensed with a Mattermost // IsEnterpriseAdvancedLicensedOrDevelopment returns true when the server is licensed with a Mattermost
// Premium License, or has `EnableDeveloper` and `EnableTesting` configuration settings // Enterprise Advanced License, or has `EnableDeveloper` and `EnableTesting` configuration settings
func IsPremiumLicensedOrDevelopment(config *model.Config, license *model.License) bool { func IsEnterpriseAdvancedLicensedOrDevelopment(config *model.Config, license *model.License) bool {
if license != nil && license.SkuShortName == model.LicenseShortSkuPremium { if license != nil && license.SkuShortName == model.LicenseShortSkuEnterpriseAdvanced {
return true 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) { 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) { 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) { 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), FutureFeatures: bToP(false),
}})) }}))
}) })
t.Run("should have no affect of future features", func(t *testing.T) { 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), FutureFeatures: bToP(true),
}})) }}))
}) })
t.Run("no license, no config", func(t *testing.T) { 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) { 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}}, &model.Config{ServiceSettings: model.ServiceSettings{EnableDeveloper: nil, EnableTesting: nil}},
nil, nil,
)) ))
}) })
t.Run("no license, only developer mode", func(t *testing.T) { 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)}}, &model.Config{ServiceSettings: model.ServiceSettings{EnableDeveloper: bToP(true), EnableTesting: bToP(false)}},
nil, nil,
)) ))
}) })
t.Run("no license, only testing mode", func(t *testing.T) { 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)}}, &model.Config{ServiceSettings: model.ServiceSettings{EnableDeveloper: bToP(false), EnableTesting: bToP(true)}},
nil, nil,
)) ))
}) })
t.Run("no license, developer and testing mode", func(t *testing.T) { 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)}}, &model.Config{ServiceSettings: model.ServiceSettings{EnableDeveloper: bToP(true), EnableTesting: bToP(true)}},
nil, nil,
)) ))
}) })
t.Run("license with E10 SKU name, disabled future features", func(t *testing.T) { 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", SkuShortName: "E10",
Features: &model.Features{FutureFeatures: bToP(false)}, Features: &model.Features{FutureFeatures: bToP(false)},
})) }))
}) })
t.Run("license with E10 SKU name, enabled future features", func(t *testing.T) { 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", SkuShortName: "E10",
Features: &model.Features{FutureFeatures: bToP(true)}, Features: &model.Features{FutureFeatures: bToP(true)},
})) }))
}) })
t.Run("license with E20 SKU name, disabled future features", func(t *testing.T) { 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", SkuShortName: "E20",
Features: &model.Features{FutureFeatures: bToP(false)}, Features: &model.Features{FutureFeatures: bToP(false)},
})) }))
}) })
t.Run("license with E20 SKU name, enabled future features", func(t *testing.T) { 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", SkuShortName: "E20",
Features: &model.Features{FutureFeatures: bToP(true)}, Features: &model.Features{FutureFeatures: bToP(true)},
})) }))

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

@@ -86,7 +86,7 @@ describe('components/channel_banner', () => {
general: { general: {
license: { license: {
IsLicensed: 'true', IsLicensed: 'true',
SkuShortName: LicenseSkus.Premium, SkuShortName: LicenseSkus.EnterpriseAdvanced,
}, },
}, },
channels: { channels: {

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

@@ -277,12 +277,12 @@ describe('ChannelSettingsModal', () => {
expect(screen.queryByTestId('configuration-tab-button')).not.toBeInTheDocument(); expect(screen.queryByTestId('configuration-tab-button')).not.toBeInTheDocument();
}); });
it('should show configuration tab when premium license', async () => { it('should show configuration tab when enterprise advanced license', async () => {
const baseState: DeepPartial<GlobalState> = { const baseState: DeepPartial<GlobalState> = {
entities: { entities: {
general: { general: {
license: { license: {
SkuShortName: 'premium', SkuShortName: 'advanced',
}, },
}, },
}, },

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

@@ -77,5 +77,5 @@ export default {
CUSTOM_GROUP_USER_ROLE: 'custom_group_user', CUSTOM_GROUP_USER_ROLE: 'custom_group_user',
MAX_GET_ROLES_BY_NAMES: 100, MAX_GET_ROLES_BY_NAMES: 100,
SKUEnterprise: 'enterprise', SKUEnterprise: 'enterprise',
SKUPremium: 'premium', SKUEnterpriseAdvanced: 'advanced',
}; };

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

@@ -17,7 +17,7 @@ describe('Selectors.ChannelBanner', () => {
entities: { entities: {
general: { general: {
license: { license: {
SkuShortName: General.SKUPremium, SkuShortName: General.SKUEnterpriseAdvanced,
}, },
}, },
channels: { channels: {
@@ -37,7 +37,7 @@ describe('Selectors.ChannelBanner', () => {
}, },
}; };
test('should return false when license is not premium', () => { test('should return false when license is not enterprise advanced', () => {
const state: DeepPartial<GlobalState> = { const state: DeepPartial<GlobalState> = {
...baseState, ...baseState,
entities: { entities: {

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

@@ -10,7 +10,7 @@ import {getLicense} from 'mattermost-redux/selectors/entities/general';
export const selectChannelBannerEnabled = (state: GlobalState): boolean => { export const selectChannelBannerEnabled = (state: GlobalState): boolean => {
const license = getLicense(state); const license = getLicense(state);
return license?.SkuShortName === General.SKUPremium; return license?.SkuShortName === General.SKUEnterpriseAdvanced;
}; };
export const selectShowChannelBanner = (state: GlobalState, channelId: string): boolean => { export const selectShowChannelBanner = (state: GlobalState, channelId: string): boolean => {

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

@@ -542,7 +542,7 @@ export enum LicenseSkus {
Starter = 'starter', Starter = 'starter',
Professional = 'professional', Professional = 'professional',
Enterprise = 'enterprise', Enterprise = 'enterprise',
Premium = 'premium', EnterpriseAdvanced = 'advanced',
} }
export function getLicenseTier(licenseSku: string): number { export function getLicenseTier(licenseSku: string): number {
@@ -551,7 +551,7 @@ export function getLicenseTier(licenseSku: string): number {
return 10; return 10;
case LicenseSkus.Enterprise: case LicenseSkus.Enterprise:
return 20; return 20;
case LicenseSkus.Premium: case LicenseSkus.EnterpriseAdvanced:
return 30; return 30;
default: default:
return 0; return 0;

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

@@ -88,7 +88,7 @@ export const isEnterpriseLicense = (license?: ClientLicense) => {
switch (license?.SkuShortName) { switch (license?.SkuShortName) {
case LicenseSkus.Enterprise: case LicenseSkus.Enterprise:
case LicenseSkus.E20: case LicenseSkus.E20:
case LicenseSkus.Premium: case LicenseSkus.EnterpriseAdvanced:
return true; return true;
} }

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

@@ -22,7 +22,7 @@ export const getSkuDisplayName = (skuShortName: string, isGovSku: boolean): stri
skuName = 'Enterprise'; skuName = 'Enterprise';
break; break;
default: default:
skuName = 'Premium'; skuName = 'Enterprise Advanced';
break; break;
} }