* Added premium SKU

* removed duplicate enterprise license check functions

* Added license check on API layer

* lint fix

* lint fix

* refactured signature:

* test: Add comprehensive tests for license tier check functions

* fixed test

* text update

* optimised license checks

* fixedf test

* Updated license valid function

* webapp license checks

* handling prekium SKU in webappp:

* added plugin api method and general refactoring

* Updated tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Harshil Sharma
2025-04-03 13:07:54 +05:30
коммит произвёл GitHub
родитель 21ca303b5e
Коммит a9f09cadc2
30 изменённых файлов: 409 добавлений и 163 удалений

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

@@ -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.LicenseShortSkuEnterprise))
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium))
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.LicenseShortSkuEnterprise))
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium))
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.LicenseShortSkuEnterprise))
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium))
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.LicenseShortSkuEnterprise))
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuPremium))
defer func() {
th.App.Srv().RemoveLicense()
}()
@@ -5728,7 +5728,7 @@ func TestCanEditChannelBanner(t *testing.T) {
})
t.Run("when channel type is direct message", func(t *testing.T) {
license := model.NewTestLicenseSKU(model.LicenseShortSkuEnterprise)
license := model.NewTestLicenseSKU(model.LicenseShortSkuPremium)
channel := &model.Channel{
Type: model.ChannelTypeDirect,
}
@@ -5741,7 +5741,7 @@ func TestCanEditChannelBanner(t *testing.T) {
})
t.Run("when channel type is group message", func(t *testing.T) {
license := model.NewTestLicenseSKU(model.LicenseShortSkuEnterprise)
license := model.NewTestLicenseSKU(model.LicenseShortSkuPremium)
channel := &model.Channel{
Type: model.ChannelTypeGroup,
}
@@ -5753,7 +5753,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.LicenseShortSkuEnterprise)
license := model.NewTestLicenseSKU(model.LicenseShortSkuPremium)
channel := &model.Channel{
Type: model.ChannelTypeOpen,
}
@@ -5763,7 +5763,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.LicenseShortSkuEnterprise)
license := model.NewTestLicenseSKU(model.LicenseShortSkuPremium)
channel := &model.Channel{
Type: model.ChannelTypePrivate,
}