[MM-21123] Add Labels to upstream Marketplace response (#13425)
* Add Labels to upstream Marketplace response * Add LOCAL label to local plugins
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8e2c59ca00
Коммит
1f3f8fbf57
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"`
|
||||
|
||||
Ссылка в новой задаче
Block a user