[MM-30292] Don't include prepackaged plugin into Marketplace response for cloud (#16543)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9572293c57
Коммит
c38dd22261
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user