Remove support for unused product interfaces (#24965)
We no longer rely on commands and hooks for products, so simplify this code.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1de790a4fe
Коммит
2ba91e43b6
@@ -13,8 +13,6 @@ import (
|
||||
model "github.com/mattermost/mattermost/server/public/model"
|
||||
|
||||
plugin "github.com/mattermost/mattermost/server/public/plugin"
|
||||
|
||||
product "github.com/mattermost/mattermost/server/v8/channels/product"
|
||||
)
|
||||
|
||||
// ServerIface is an autogenerated mock type for the ServerIface type
|
||||
@@ -126,22 +124,6 @@ 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()
|
||||
|
||||
@@ -17,7 +17,6 @@ import (
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/plugin"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/product"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/utils"
|
||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
||||
@@ -102,7 +101,6 @@ 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 {
|
||||
@@ -199,7 +197,6 @@ func (ts *TelemetryService) sendDailyTelemetry(override bool) {
|
||||
ts.trackGroups()
|
||||
ts.trackChannelModeration()
|
||||
ts.trackWarnMetrics()
|
||||
ts.trackProducts()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -987,18 +984,6 @@ 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,
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/mattermost/mattermost/server/public/plugin"
|
||||
"github.com/mattermost/mattermost/server/public/plugin/plugintest"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/product"
|
||||
storeMocks "github.com/mattermost/mattermost/server/v8/channels/store/storetest/mocks"
|
||||
"github.com/mattermost/mattermost/server/v8/config"
|
||||
"github.com/mattermost/mattermost/server/v8/platform/services/httpservice"
|
||||
@@ -189,7 +188,6 @@ 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