mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-54505: re-enable remote marketplace functionality (#24561)
This commit is contained in:
parent
64fabbeed3
commit
9a3b503169
@ -462,8 +462,6 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetMarketplacePlugins(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@ -685,8 +683,6 @@ func TestGetMarketplacePlugins(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetInstalledMarketplacePlugins(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
samplePlugins := []*model.MarketplacePlugin{
|
||||
{
|
||||
@ -831,8 +827,6 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchGetMarketplacePlugins(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
samplePlugins := []*model.MarketplacePlugin{
|
||||
{
|
||||
@ -959,8 +953,6 @@ func TestSearchGetMarketplacePlugins(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLocalPluginInMarketplace(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@ -1123,8 +1115,6 @@ func TestGetLocalPluginInMarketplace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRemotePluginInMarketplace(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@ -1181,69 +1171,7 @@ func TestGetRemotePluginInMarketplace(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestRemoteMarketplaceDisabledByStreamlinedMarketplaceFlag(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
marketplacePlugins := []*model.MarketplacePlugin{
|
||||
{
|
||||
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
|
||||
HomepageURL: "https://example.com/mattermost/mattermost-plugin-nps",
|
||||
IconData: "https://example.com/icon.svg",
|
||||
DownloadURL: "www.github.com/example",
|
||||
Manifest: &model.Manifest{
|
||||
Id: "marketplace.test",
|
||||
Name: "marketplacetest",
|
||||
Description: "a marketplace plugin",
|
||||
Version: "0.1.2",
|
||||
MinServerVersion: "",
|
||||
},
|
||||
},
|
||||
InstalledVersion: "",
|
||||
},
|
||||
}
|
||||
|
||||
testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
res.WriteHeader(http.StatusOK)
|
||||
json, err := json.Marshal([]*model.MarketplacePlugin{marketplacePlugins[0]})
|
||||
require.NoError(t, err)
|
||||
res.Write(json)
|
||||
}))
|
||||
defer testServer.Close()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.PluginSettings.Enable = true
|
||||
*cfg.PluginSettings.EnableMarketplace = true
|
||||
*cfg.PluginSettings.EnableRemoteMarketplace = true
|
||||
*cfg.PluginSettings.EnableUploads = true
|
||||
*cfg.PluginSettings.MarketplaceURL = testServer.URL
|
||||
})
|
||||
|
||||
prepackagePlugin := &plugin.PrepackagedPlugin{
|
||||
Manifest: &model.Manifest{
|
||||
Version: "0.0.1",
|
||||
Id: "prepackaged.test",
|
||||
},
|
||||
}
|
||||
|
||||
env := th.App.GetPluginsEnvironment()
|
||||
env.SetPrepackagedPlugins([]*plugin.PrepackagedPlugin{prepackagePlugin}, nil)
|
||||
|
||||
// No marketplace plugins returned
|
||||
plugins, _, err := th.SystemAdminClient.GetMarketplacePlugins(context.Background(), &model.MarketplacePluginFilter{})
|
||||
require.NoError(t, err)
|
||||
|
||||
// Only returns the prepackaged plugins
|
||||
require.Len(t, plugins, 1)
|
||||
require.Equal(t, prepackagePlugin.Manifest, plugins[0].Manifest)
|
||||
}
|
||||
|
||||
func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@ -1376,8 +1304,6 @@ func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@ -1729,8 +1655,6 @@ func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInstallMarketplacePluginPrepackagedDisabled(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
|
||||
path, _ := fileutils.FindDir("tests")
|
||||
|
||||
|
@ -855,8 +855,6 @@ func TestPushNotificationAck(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCompleteOnboarding(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_STREAMLINEDMARKETPLACE")
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
@ -552,7 +552,7 @@ func (a *App) GetPlugins() (*model.PluginsResponse, *model.AppError) {
|
||||
func (a *App) GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*model.MarketplacePlugin, *model.AppError) {
|
||||
plugins := map[string]*model.MarketplacePlugin{}
|
||||
|
||||
if *a.Config().PluginSettings.EnableRemoteMarketplace && !a.Config().FeatureFlags.StreamlinedMarketplace && !filter.LocalOnly {
|
||||
if *a.Config().PluginSettings.EnableRemoteMarketplace && !filter.LocalOnly {
|
||||
p, appErr := a.getRemotePlugins()
|
||||
if appErr != nil {
|
||||
return nil, appErr
|
||||
|
@ -289,7 +289,7 @@ func (ch *Channels) InstallMarketplacePlugin(request *model.InstallMarketplacePl
|
||||
signatureFile = bytes.NewReader(prepackagedPlugin.Signature)
|
||||
}
|
||||
|
||||
if *ch.cfgSvc.Config().PluginSettings.EnableRemoteMarketplace && !ch.cfgSvc.Config().FeatureFlags.StreamlinedMarketplace {
|
||||
if *ch.cfgSvc.Config().PluginSettings.EnableRemoteMarketplace {
|
||||
var plugin *model.BaseMarketplacePlugin
|
||||
plugin, appErr = ch.getRemoteMarketplacePlugin(request.Id, request.Version)
|
||||
// The plugin might only be prepackaged and not on the Marketplace.
|
||||
|
@ -76,16 +76,8 @@ exports[`components/marketplace/ doesn't show web marketplace banner in FeatureF
|
||||
<div
|
||||
className="GenericModal__body"
|
||||
>
|
||||
<MarketplaceList
|
||||
filter=""
|
||||
listRef={
|
||||
Object {
|
||||
"current": null,
|
||||
}
|
||||
}
|
||||
listing={Array []}
|
||||
noResultsMessage="No plugins found"
|
||||
page={0}
|
||||
<LoadingScreen
|
||||
className="loading"
|
||||
/>
|
||||
</div>
|
||||
</ModalBody>
|
||||
@ -169,49 +161,8 @@ exports[`components/marketplace/ hides search, shows web marketplace banner in F
|
||||
<div
|
||||
className="GenericModal__body"
|
||||
>
|
||||
<MarketplaceList
|
||||
filter=""
|
||||
listRef={
|
||||
Object {
|
||||
"current": null,
|
||||
}
|
||||
}
|
||||
listing={
|
||||
Array [
|
||||
Object {
|
||||
"author_type": "mattermost",
|
||||
"download_url": "https://github.com/mattermost/mattermost-plugin-nps/releases/download/v1.0.3/com.mattermost.nps-1.0.3.tar.gz",
|
||||
"enterprise": false,
|
||||
"homepage_url": "https://github.com/mattermost/mattermost-plugin-nps",
|
||||
"installed_version": "",
|
||||
"manifest": Object {
|
||||
"description": "This plugin sends quarterly user satisfaction surveys to gather feedback and help improve Mattermost",
|
||||
"id": "com.mattermost.nps",
|
||||
"min_server_version": "5.14.0",
|
||||
"name": "User Satisfaction Surveys",
|
||||
"version": "1.0.3",
|
||||
},
|
||||
"release_stage": "production",
|
||||
},
|
||||
Object {
|
||||
"author_type": "mattermost",
|
||||
"download_url": "https://github.com/mattermost/mattermost-test/releases/download/v1.0.3/com.mattermost.nps-1.0.3.tar.gz",
|
||||
"enterprise": false,
|
||||
"homepage_url": "https://github.com/mattermost/mattermost-test",
|
||||
"installed_version": "1.0.3",
|
||||
"manifest": Object {
|
||||
"description": "This plugin is to test",
|
||||
"id": "com.mattermost.test",
|
||||
"min_server_version": "5.14.0",
|
||||
"name": "Test",
|
||||
"version": "1.0.3",
|
||||
},
|
||||
"release_stage": "production",
|
||||
},
|
||||
]
|
||||
}
|
||||
noResultsMessage="No plugins found"
|
||||
page={0}
|
||||
<LoadingScreen
|
||||
className="loading"
|
||||
/>
|
||||
</div>
|
||||
</ModalBody>
|
||||
|
@ -251,13 +251,17 @@ const MarketplaceModal = ({
|
||||
>
|
||||
{isStreamlinedMarketplaceEnabled ? (
|
||||
<>
|
||||
<MarketplaceList
|
||||
listRef={listRef}
|
||||
listing={listing}
|
||||
page={page}
|
||||
filter={filter}
|
||||
noResultsMessage={formatMessage({id: 'marketplace_modal.no_plugins', defaultMessage: 'No plugins found'})}
|
||||
/>
|
||||
{loading ? (
|
||||
<LoadingScreen className='loading'/>
|
||||
) : (
|
||||
<MarketplaceList
|
||||
listRef={listRef}
|
||||
listing={listing}
|
||||
page={page}
|
||||
filter={filter}
|
||||
noResultsMessage={formatMessage({id: 'marketplace_modal.no_plugins', defaultMessage: 'No plugins found'})}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<Tabs
|
||||
|
Loading…
Reference in New Issue
Block a user