Cloud Freemium - Integrations (#20185)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
54a88fb532
Коммит
ea5bfe3fd9
@@ -324,14 +324,14 @@ func (c *Client4) cloudRoute() string {
|
||||
return "/cloud"
|
||||
}
|
||||
|
||||
func (c *Client4) usageRoute() string {
|
||||
return "/usage"
|
||||
}
|
||||
|
||||
func (c *Client4) testEmailRoute() string {
|
||||
return "/email/test"
|
||||
}
|
||||
|
||||
func (c *Client4) usageRoute() string {
|
||||
return "/usage"
|
||||
}
|
||||
|
||||
func (c *Client4) testSiteURLRoute() string {
|
||||
return "/site_url/test"
|
||||
}
|
||||
@@ -8110,3 +8110,16 @@ func (c *Client4) GetPostsUsage() (*PostsUsage, *Response, error) {
|
||||
err = json.NewDecoder(r.Body).Decode(&usage)
|
||||
return usage, BuildResponse(r), err
|
||||
}
|
||||
|
||||
// GetIntegrationsUsage returns usage information on integrations, including the count of enabled integrations
|
||||
func (c *Client4) GetIntegrationsUsage() (*IntegrationsUsage, *Response, error) {
|
||||
r, err := c.DoAPIGet(c.usageRoute()+"/integrations", "")
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
var usage *IntegrationsUsage
|
||||
err = json.NewDecoder(r.Body).Decode(&usage)
|
||||
return usage, BuildResponse(r), err
|
||||
}
|
||||
|
||||
@@ -2780,34 +2780,34 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
||||
s.PluginStates = make(map[string]*PluginState)
|
||||
}
|
||||
|
||||
if s.PluginStates["com.mattermost.nps"] == nil {
|
||||
if s.PluginStates[PluginIdNPS] == nil {
|
||||
// Enable the NPS plugin by default if diagnostics are enabled
|
||||
s.PluginStates["com.mattermost.nps"] = &PluginState{Enable: ls.EnableDiagnostics == nil || *ls.EnableDiagnostics}
|
||||
s.PluginStates[PluginIdNPS] = &PluginState{Enable: ls.EnableDiagnostics == nil || *ls.EnableDiagnostics}
|
||||
}
|
||||
|
||||
if s.PluginStates["playbooks"] == nil {
|
||||
if s.PluginStates[PluginIdPlaybooks] == nil {
|
||||
// Enable the playbooks plugin by default
|
||||
s.PluginStates["playbooks"] = &PluginState{Enable: true}
|
||||
s.PluginStates[PluginIdPlaybooks] = &PluginState{Enable: true}
|
||||
}
|
||||
|
||||
if s.PluginStates["com.mattermost.plugin-channel-export"] == nil && BuildEnterpriseReady == "true" {
|
||||
if s.PluginStates[PluginIdChannelExport] == nil && BuildEnterpriseReady == "true" {
|
||||
// Enable the channel export plugin by default
|
||||
s.PluginStates["com.mattermost.plugin-channel-export"] = &PluginState{Enable: true}
|
||||
s.PluginStates[PluginIdChannelExport] = &PluginState{Enable: true}
|
||||
}
|
||||
|
||||
if s.PluginStates["focalboard"] == nil {
|
||||
if s.PluginStates[PluginIdFocalboard] == nil {
|
||||
// Enable the focalboard plugin by default
|
||||
s.PluginStates["focalboard"] = &PluginState{Enable: true}
|
||||
s.PluginStates[PluginIdFocalboard] = &PluginState{Enable: true}
|
||||
}
|
||||
|
||||
if s.PluginStates["com.mattermost.apps"] == nil {
|
||||
if s.PluginStates[PluginIdApps] == nil {
|
||||
// Enable the Apps plugin by default
|
||||
s.PluginStates["com.mattermost.apps"] = &PluginState{Enable: true}
|
||||
s.PluginStates[PluginIdApps] = &PluginState{Enable: true}
|
||||
}
|
||||
|
||||
if s.PluginStates["com.mattermost.calls"] == nil && IsCloud() {
|
||||
if s.PluginStates[PluginIdCalls] == nil && IsCloud() {
|
||||
// Enable the calls plugin by default on Cloud only
|
||||
s.PluginStates["com.mattermost.calls"] = &PluginState{Enable: true}
|
||||
s.PluginStates[PluginIdCalls] = &PluginState{Enable: true}
|
||||
}
|
||||
|
||||
if s.EnableMarketplace == nil {
|
||||
|
||||
13
model/plugin_constants.go
Обычный файл
13
model/plugin_constants.go
Обычный файл
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package model
|
||||
|
||||
const (
|
||||
PluginIdPlaybooks = "playbooks"
|
||||
PluginIdFocalboard = "focalboard"
|
||||
PluginIdApps = "com.mattermost.apps"
|
||||
PluginIdCalls = "com.mattermost.calls"
|
||||
PluginIdNPS = "com.mattermost.nps"
|
||||
PluginIdChannelExport = "com.mattermost.plugin-channel-export"
|
||||
)
|
||||
@@ -6,3 +6,24 @@ package model
|
||||
type PostsUsage struct {
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
|
||||
type IntegrationsUsage struct {
|
||||
Enabled int `json:"enabled"`
|
||||
}
|
||||
|
||||
var InstalledIntegrationsIgnoredPlugins = map[string]struct{}{
|
||||
PluginIdPlaybooks: {},
|
||||
PluginIdFocalboard: {},
|
||||
PluginIdApps: {},
|
||||
PluginIdCalls: {},
|
||||
PluginIdNPS: {},
|
||||
PluginIdChannelExport: {},
|
||||
}
|
||||
|
||||
type InstalledIntegration struct {
|
||||
Type string `json:"type"` // "plugin" or "app"
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ const (
|
||||
WebsocketEventThreadFollowChanged = "thread_follow_changed"
|
||||
WebsocketEventThreadReadChanged = "thread_read_changed"
|
||||
WebsocketFirstAdminVisitMarketplaceStatusReceived = "first_admin_visit_marketplace_status_received"
|
||||
WebsocketEventIntegrationsUsageChanged = "integrations_usage_changed"
|
||||
)
|
||||
|
||||
type WebSocketMessage interface {
|
||||
|
||||
Ссылка в новой задаче
Block a user