Merge branch 'master' of github.com:mattermost/mattermost-server into MM-47853-true-up-review-telemetry-off-non-air-gapped
Этот коммит содержится в:
@@ -13,6 +13,8 @@ import (
|
||||
model "github.com/mattermost/mattermost-server/v6/model"
|
||||
|
||||
plugin "github.com/mattermost/mattermost-server/v6/plugin"
|
||||
|
||||
product "github.com/mattermost/mattermost-server/v6/product"
|
||||
)
|
||||
|
||||
// ServerIface is an autogenerated mock type for the ServerIface type
|
||||
@@ -118,6 +120,22 @@ func (_m *ServerIface) HTTPService() httpservice.HTTPService {
|
||||
return r0
|
||||
}
|
||||
|
||||
// HooksManager provides a mock function with given fields:
|
||||
func (_m *ServerIface) HooksManager() *product.HooksManager {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 *product.HooksManager
|
||||
if rf, ok := ret.Get(0).(func() *product.HooksManager); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*product.HooksManager)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// IsLeader provides a mock function with given fields:
|
||||
func (_m *ServerIface) IsLeader() bool {
|
||||
ret := _m.Called()
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/plugin"
|
||||
"github.com/mattermost/mattermost-server/v6/product"
|
||||
"github.com/mattermost/mattermost-server/v6/services/httpservice"
|
||||
"github.com/mattermost/mattermost-server/v6/services/marketplace"
|
||||
"github.com/mattermost/mattermost-server/v6/services/searchengine"
|
||||
@@ -93,6 +94,7 @@ type ServerIface interface {
|
||||
License() *model.License
|
||||
GetRoleByName(context.Context, string) (*model.Role, *model.AppError)
|
||||
GetSchemes(string, int, int) ([]*model.Scheme, *model.AppError)
|
||||
HooksManager() *product.HooksManager
|
||||
}
|
||||
|
||||
type TelemetryService struct {
|
||||
@@ -167,6 +169,7 @@ func (ts *TelemetryService) sendDailyTelemetry(override bool) {
|
||||
ts.trackGroups()
|
||||
ts.trackChannelModeration()
|
||||
ts.trackWarnMetrics()
|
||||
ts.trackProducts()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +460,7 @@ func (ts *TelemetryService) trackConfig() {
|
||||
"restrict_link_previews": isDefault(*cfg.ServiceSettings.RestrictLinkPreviews, ""),
|
||||
"enable_custom_groups": *cfg.ServiceSettings.EnableCustomGroups,
|
||||
"post_priority": *cfg.ServiceSettings.PostPriority,
|
||||
"self_hosted_first_time_purchase": *cfg.ServiceSettings.SelfHostedFirstTimePurchase,
|
||||
"self_hosted_purchase": *cfg.ServiceSettings.SelfHostedPurchase,
|
||||
"allow_synced_drafts": *cfg.ServiceSettings.AllowSyncedDrafts,
|
||||
})
|
||||
|
||||
@@ -946,6 +949,18 @@ func (ts *TelemetryService) trackPlugins() {
|
||||
}, plugin.OnSendDailyTelemetryID)
|
||||
}
|
||||
|
||||
func (ts *TelemetryService) trackProducts() {
|
||||
hm := ts.srv.HooksManager()
|
||||
if hm == nil {
|
||||
return
|
||||
}
|
||||
|
||||
hm.RunMultiHook(func(hooks plugin.Hooks) bool {
|
||||
hooks.OnSendDailyTelemetry()
|
||||
return true
|
||||
}, plugin.OnSendDailyTelemetryID)
|
||||
}
|
||||
|
||||
func (ts *TelemetryService) trackServer() {
|
||||
data := map[string]any{
|
||||
"edition": model.BuildEnterpriseReady,
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/plugin"
|
||||
"github.com/mattermost/mattermost-server/v6/plugin/plugintest"
|
||||
"github.com/mattermost/mattermost-server/v6/product"
|
||||
"github.com/mattermost/mattermost-server/v6/services/httpservice"
|
||||
"github.com/mattermost/mattermost-server/v6/services/searchengine"
|
||||
"github.com/mattermost/mattermost-server/v6/services/telemetry/mocks"
|
||||
@@ -189,6 +190,7 @@ func initializeMocks(cfg *model.Config, cloudLicense bool) (*mocks.ServerIface,
|
||||
serverIfaceMock.On("GetRoleByName", context.Background(), "channel_guest").Return(&model.Role{Permissions: []string{"cg-test1", "cg-test2"}}, nil)
|
||||
serverIfaceMock.On("GetSchemes", "team", 0, 100).Return([]*model.Scheme{}, nil)
|
||||
serverIfaceMock.On("HTTPService").Return(httpservice.MakeHTTPService(configService))
|
||||
serverIfaceMock.On("HooksManager").Return(product.NewHooksManager(nil))
|
||||
|
||||
storeMock := &storeMocks.Store{}
|
||||
storeMock.On("GetDbVersion", false).Return("5.24.0", nil)
|
||||
|
||||
Ссылка в новой задаче
Block a user