diff --git a/api4/plugin_test.go b/api4/plugin_test.go index 86e4f388a8..91512a04bc 100644 --- a/api4/plugin_test.go +++ b/api4/plugin_test.go @@ -1226,6 +1226,21 @@ func TestGetPrepackagedPluginInMarketplace(t *testing.T) { require.Len(t, plugins, 1) require.Equal(t, newerPrepackagePlugin.Manifest, plugins[0].Manifest) }) + + t.Run("prepackaged plugins are not shown in Cloud", func(t *testing.T) { + th.App.UpdateConfig(func(cfg *model.Config) { + *cfg.PluginSettings.EnableRemoteMarketplace = true + *cfg.PluginSettings.EnableUploads = true + }) + + th.App.Srv().SetLicense(model.NewTestLicense("cloud")) + + plugins, resp := th.SystemAdminClient.GetMarketplacePlugins(&model.MarketplacePluginFilter{}) + CheckNoError(t, resp) + + require.ElementsMatch(t, marketplacePlugins, plugins) + require.Len(t, plugins, 1) + }) } func TestInstallMarketplacePlugin(t *testing.T) { diff --git a/app/plugin.go b/app/plugin.go index 38768a588b..92899f60e4 100644 --- a/app/plugin.go +++ b/app/plugin.go @@ -459,12 +459,20 @@ func (a *App) GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*m plugins = p } - appErr := a.mergePrepackagedPlugins(plugins) - if appErr != nil { - return nil, appErr + // Some plugin don't work on cloud. The remote Marketplace is aware of this fact, + // but prepackaged plugins are not. Hence, on a cloud installation prepackaged plugins + // shouldn't be shown in the Marketplace modal. + // This is a short term fix. The long term solution is to have a separate set of + // prepacked plugins for cloud: https://mattermost.atlassian.net/browse/MM-31331. + license := a.Srv().License() + if license == nil || !*license.Features.Cloud { + appErr := a.mergePrepackagedPlugins(plugins) + if appErr != nil { + return nil, appErr + } } - appErr = a.mergeLocalPlugins(plugins) + appErr := a.mergeLocalPlugins(plugins) if appErr != nil { return nil, appErr }