diff --git a/app/plugin_test.go b/app/plugin_test.go index 57802c67ac..20dac9ec6b 100644 --- a/app/plugin_test.go +++ b/app/plugin_test.go @@ -7,7 +7,6 @@ import ( "bytes" "crypto/sha256" "encoding/base64" - "errors" "fmt" "io" "net/http" @@ -19,11 +18,9 @@ import ( "github.com/gorilla/mux" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v6/app/request" - "github.com/mattermost/mattermost-server/v6/einterfaces/mocks" "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/plugin" "github.com/mattermost/mattermost-server/v6/shared/mlog" @@ -1007,65 +1004,6 @@ func TestProcessPrepackagedPlugins(t *testing.T) { }) } -func TestEnablePluginWithCloudLimits(t *testing.T) { - th := Setup(t) - defer th.TearDown() - - th.App.Srv().SetLicense(model.NewTestLicense("cloud")) - - th.App.UpdateConfig(func(cfg *model.Config) { - *cfg.PluginSettings.Enable = true - *cfg.PluginSettings.RequirePluginSignature = false - cfg.PluginSettings.PluginStates["testplugin"] = &model.PluginState{Enable: false} - cfg.PluginSettings.PluginStates["testplugin2"] = &model.PluginState{Enable: false} - }) - - cloud := &mocks.CloudInterface{} - cloud.Mock.On("GetCloudLimits", mock.Anything).Return(&model.ProductLimits{ - Integrations: &model.IntegrationsLimits{ - Enabled: model.NewInt(1), - }, - }, nil) - - cloudImpl := th.App.Srv().Cloud - defer func() { - th.App.Srv().Cloud = cloudImpl - }() - th.App.Srv().Cloud = cloud - - env := th.App.GetPluginsEnvironment() - require.NotNil(t, env) - - path, _ := fileutils.FindDir("tests") - fileReader, err := os.Open(filepath.Join(path, "testplugin.tar.gz")) - require.NoError(t, err) - defer fileReader.Close() - - _, appErr := th.App.WriteFile(fileReader, getBundleStorePath("testplugin")) - checkNoError(t, appErr) - - fileReader, err = os.Open(filepath.Join(path, "testplugin2.tar.gz")) - require.NoError(t, err) - defer fileReader.Close() - - _, appErr = th.App.WriteFile(fileReader, getBundleStorePath("testplugin2")) - checkNoError(t, appErr) - - appErr = th.App.SyncPlugins() - checkNoError(t, appErr) - - appErr = th.App.EnablePlugin("testplugin") - checkNoError(t, appErr) - - // Let enable succeed if a CWS error occurs - cloud = &mocks.CloudInterface{} - th.App.Srv().Cloud = cloud - cloud.Mock.On("GetCloudLimits", mock.Anything).Return(nil, errors.New("error getting limits")) - - appErr = th.App.EnablePlugin("testplugin2") - checkNoError(t, appErr) -} - func TestGetPluginStateOverride(t *testing.T) { th := Setup(t) defer th.TearDown() diff --git a/model/cloud.go b/model/cloud.go index 48383f48e8..7e74f3c17e 100644 --- a/model/cloud.go +++ b/model/cloud.go @@ -268,6 +268,11 @@ type SubscriptionChange struct { DowngradeFeedback *DowngradeFeedback `json:"downgrade_feedback"` } +// TODO remove BoardsLimits. +// It is not used for real. +// Focalboard has some lingering code using this struct +// https://github.com/mattermost/focalboard/blob/fd4cf95f8ac9ba616864b25bf91bb1e4ec21335a/server/app/cloud.go#L86 +// we should remove this struct once that code is removed. type BoardsLimits struct { Cards *int `json:"cards"` Views *int `json:"views"` @@ -277,10 +282,6 @@ type FilesLimits struct { TotalStorage *int64 `json:"total_storage"` } -type IntegrationsLimits struct { - Enabled *int `json:"enabled"` -} - type MessagesLimits struct { History *int `json:"history"` } @@ -290,11 +291,15 @@ type TeamsLimits struct { } type ProductLimits struct { - Boards *BoardsLimits `json:"boards,omitempty"` - Files *FilesLimits `json:"files,omitempty"` - Integrations *IntegrationsLimits `json:"integrations,omitempty"` - Messages *MessagesLimits `json:"messages,omitempty"` - Teams *TeamsLimits `json:"teams,omitempty"` + // TODO remove Boards property. + // It is not used for real. + // Focalboard has some lingering code using this property + // https://github.com/mattermost/focalboard/blob/fd4cf95f8ac9ba616864b25bf91bb1e4ec21335a/server/app/cloud.go#L86 + // we should remove this property once that code is removed. + Boards *BoardsLimits `json:"boards,omitempty"` + Files *FilesLimits `json:"files,omitempty"` + Messages *MessagesLimits `json:"messages,omitempty"` + Teams *TeamsLimits `json:"teams,omitempty"` } // CreateSubscriptionRequest is the parameters for the API request to create a subscription. diff --git a/model/notify_admin.go b/model/notify_admin.go index 247b28e11e..c4840ab24f 100644 --- a/model/notify_admin.go +++ b/model/notify_admin.go @@ -18,8 +18,6 @@ const ( PaidFeaturePlaybooksRetrospective = MattermostPaidFeature("mattermost.feature.playbooks_retro") PaidFeatureUnlimitedMessages = MattermostPaidFeature("mattermost.feature.unlimited_messages") PaidFeatureUnlimitedFileStorage = MattermostPaidFeature("mattermost.feature.unlimited_file_storage") - PaidFeatureUnlimitedIntegrations = MattermostPaidFeature("mattermost.feature.unlimited_integrations") - PaidFeatureUnlimitedBoardcards = MattermostPaidFeature("mattermost.feature.unlimited_board_cards") PaidFeatureAllProfessionalfeatures = MattermostPaidFeature("mattermost.feature.all_professional") PaidFeatureAllEnterprisefeatures = MattermostPaidFeature("mattermost.feature.all_enterprise") UpgradeDowngradedWorkspace = MattermostPaidFeature("mattermost.feature.upgrade_downgraded_workspace") @@ -39,8 +37,6 @@ var paidFeatures map[MattermostPaidFeature]struct{} = map[MattermostPaidFeature] PaidFeaturePlaybooksRetrospective: {}, PaidFeatureUnlimitedMessages: {}, PaidFeatureUnlimitedFileStorage: {}, - PaidFeatureUnlimitedIntegrations: {}, - PaidFeatureUnlimitedBoardcards: {}, PaidFeatureAllProfessionalfeatures: {}, PaidFeatureAllEnterprisefeatures: {}, UpgradeDowngradedWorkspace: {},