diff --git a/api4/plugin_test.go b/api4/plugin_test.go index b9b9baa718..8ac031bff8 100644 --- a/api4/plugin_test.go +++ b/api4/plugin_test.go @@ -547,6 +547,12 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) { HomepageURL: "https://example.com/mattermost/mattermost-plugin-nps", IconData: "https://example.com/icon.svg", DownloadURL: "https://example.com/mattermost/mattermost-plugin-nps/releases/download/v1.0.3/com.mattermost.nps-1.0.3.tar.gz", + Labels: []model.MarketplaceLabel{ + { + Name: "someName", + Description: "some Description", + }, + }, Manifest: &model.Manifest{ Id: "com.mattermost.nps", Name: "User Satisfaction Surveys", @@ -594,7 +600,11 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) { HomepageURL: "", IconData: "", DownloadURL: "", - Manifest: manifest, + Labels: []model.MarketplaceLabel{{ + Name: "Local", + Description: "This plugin is not listed in the marketplace but was installed manually", + }}, + Manifest: manifest, }, InstalledVersion: manifest.Version, }) @@ -725,7 +735,11 @@ func TestSearchGetMarketplacePlugins(t *testing.T) { HomepageURL: "", IconData: "", DownloadURL: "", - Manifest: manifest, + Labels: []model.MarketplaceLabel{{ + Name: "Local", + Description: "This plugin is not listed in the marketplace but was installed manually", + }}, + Manifest: manifest, }, InstalledVersion: manifest.Version, } @@ -738,7 +752,11 @@ func TestSearchGetMarketplacePlugins(t *testing.T) { HomepageURL: "", IconData: "", DownloadURL: "", - Manifest: manifest, + Labels: []model.MarketplaceLabel{{ + Name: "Local", + Description: "This plugin is not listed in the marketplace but was installed manually", + }}, + Manifest: manifest, }, InstalledVersion: manifest.Version, } diff --git a/app/plugin.go b/app/plugin.go index ca7960e961..5ab44d5927 100644 --- a/app/plugin.go +++ b/app/plugin.go @@ -502,6 +502,11 @@ func (a *App) GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*m result = append(result, &model.MarketplacePlugin{ BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ + // Labels should not (yet) be localized as the labels sent by the Marketplace are not (yet) localizable. + Labels: []model.MarketplaceLabel{{ + Name: "Local", + Description: "This plugin is not listed in the marketplace but was installed manually", + }}, Manifest: plugin.Manifest, }, InstalledVersion: plugin.Manifest.Version, diff --git a/model/marketplace_plugin.go b/model/marketplace_plugin.go index b925f91184..b7e55d83c6 100644 --- a/model/marketplace_plugin.go +++ b/model/marketplace_plugin.go @@ -14,18 +14,26 @@ import ( "github.com/pkg/errors" ) -// BaseMarketplacePlugin is a Mattermost plugin received from the marketplace server. +// BaseMarketplacePlugin is a Mattermost plugin received from the Marketplace server. type BaseMarketplacePlugin struct { - HomepageURL string `json:"homepage_url"` - IconData string `json:"icon_data"` - DownloadURL string `json:"download_url"` - ReleaseNotesURL string `json:"release_notes_url"` - // Signature represents a signature of a plugin saved in base64 encoding. - Signature string `json:"signature"` - Manifest *Manifest `json:"manifest"` + HomepageURL string `json:"homepage_url"` + IconData string `json:"icon_data"` + DownloadURL string `json:"download_url"` + ReleaseNotesURL string `json:"release_notes_url"` + Labels []MarketplaceLabel `json:"labels"` + Signature string `json:"signature"` // Signature represents a signature of a plugin saved in base64 encoding. + Manifest *Manifest `json:"manifest"` } -// MarketplacePlugin is a state aware marketplace plugin. +// MarketplaceLabel represents a label shown in the Marketplace UI. +type MarketplaceLabel struct { + Name string `json:"name"` + Description string `json:"description"` + URL string `json:"url"` + Color string `json:"color"` +} + +// MarketplacePlugin is a state aware Marketplace plugin. type MarketplacePlugin struct { *BaseMarketplacePlugin InstalledVersion string `json:"installed_version"`