MM-27169: Remove uneeded fields from App (#15408)
* MM-27169: Remove uneeded fields from App https://mattermost.atlassian.net/browse/MM-27169 * run app-layers * Bring back searchengine Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f0fc51244c
Коммит
b329635b23
41
app/app.go
41
app/app.go
@@ -27,8 +27,10 @@ import (
|
|||||||
type App struct {
|
type App struct {
|
||||||
srv *Server
|
srv *Server
|
||||||
|
|
||||||
log *mlog.Logger
|
// XXX: This is required because removing this needs BleveEngine
|
||||||
notificationsLog *mlog.Logger
|
// to be registered in (h *MainHelper) setupStore, but that creates
|
||||||
|
// a cyclic dependency as bleve tests themselves import testlib.
|
||||||
|
searchEngine *searchengine.Broker
|
||||||
|
|
||||||
t goi18n.TranslateFunc
|
t goi18n.TranslateFunc
|
||||||
session model.Session
|
session model.Session
|
||||||
@@ -38,17 +40,6 @@ type App struct {
|
|||||||
userAgent string
|
userAgent string
|
||||||
acceptLanguage string
|
acceptLanguage string
|
||||||
|
|
||||||
cluster einterfaces.ClusterInterface
|
|
||||||
compliance einterfaces.ComplianceInterface
|
|
||||||
dataRetention einterfaces.DataRetentionInterface
|
|
||||||
searchEngine *searchengine.Broker
|
|
||||||
messageExport einterfaces.MessageExportInterface
|
|
||||||
metrics einterfaces.MetricsInterface
|
|
||||||
|
|
||||||
httpService httpservice.HTTPService
|
|
||||||
imageProxy *imageproxy.ImageProxy
|
|
||||||
timezones *timezones.Timezones
|
|
||||||
|
|
||||||
context context.Context
|
context context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,10 +417,10 @@ func (a *App) Srv() *Server {
|
|||||||
return a.srv
|
return a.srv
|
||||||
}
|
}
|
||||||
func (a *App) Log() *mlog.Logger {
|
func (a *App) Log() *mlog.Logger {
|
||||||
return a.log
|
return a.srv.Log
|
||||||
}
|
}
|
||||||
func (a *App) NotificationsLog() *mlog.Logger {
|
func (a *App) NotificationsLog() *mlog.Logger {
|
||||||
return a.notificationsLog
|
return a.srv.NotificationsLog
|
||||||
}
|
}
|
||||||
func (a *App) T(translationID string, args ...interface{}) string {
|
func (a *App) T(translationID string, args ...interface{}) string {
|
||||||
return a.t(translationID, args...)
|
return a.t(translationID, args...)
|
||||||
@@ -456,13 +447,13 @@ func (a *App) AccountMigration() einterfaces.AccountMigrationInterface {
|
|||||||
return a.srv.AccountMigration
|
return a.srv.AccountMigration
|
||||||
}
|
}
|
||||||
func (a *App) Cluster() einterfaces.ClusterInterface {
|
func (a *App) Cluster() einterfaces.ClusterInterface {
|
||||||
return a.cluster
|
return a.srv.Cluster
|
||||||
}
|
}
|
||||||
func (a *App) Compliance() einterfaces.ComplianceInterface {
|
func (a *App) Compliance() einterfaces.ComplianceInterface {
|
||||||
return a.compliance
|
return a.srv.Compliance
|
||||||
}
|
}
|
||||||
func (a *App) DataRetention() einterfaces.DataRetentionInterface {
|
func (a *App) DataRetention() einterfaces.DataRetentionInterface {
|
||||||
return a.dataRetention
|
return a.srv.DataRetention
|
||||||
}
|
}
|
||||||
func (a *App) SearchEngine() *searchengine.Broker {
|
func (a *App) SearchEngine() *searchengine.Broker {
|
||||||
return a.searchEngine
|
return a.searchEngine
|
||||||
@@ -471,10 +462,10 @@ func (a *App) Ldap() einterfaces.LdapInterface {
|
|||||||
return a.srv.Ldap
|
return a.srv.Ldap
|
||||||
}
|
}
|
||||||
func (a *App) MessageExport() einterfaces.MessageExportInterface {
|
func (a *App) MessageExport() einterfaces.MessageExportInterface {
|
||||||
return a.messageExport
|
return a.srv.MessageExport
|
||||||
}
|
}
|
||||||
func (a *App) Metrics() einterfaces.MetricsInterface {
|
func (a *App) Metrics() einterfaces.MetricsInterface {
|
||||||
return a.metrics
|
return a.srv.Metrics
|
||||||
}
|
}
|
||||||
func (a *App) Notification() einterfaces.NotificationInterface {
|
func (a *App) Notification() einterfaces.NotificationInterface {
|
||||||
return a.srv.Notification
|
return a.srv.Notification
|
||||||
@@ -483,13 +474,13 @@ func (a *App) Saml() einterfaces.SamlInterface {
|
|||||||
return a.srv.Saml
|
return a.srv.Saml
|
||||||
}
|
}
|
||||||
func (a *App) HTTPService() httpservice.HTTPService {
|
func (a *App) HTTPService() httpservice.HTTPService {
|
||||||
return a.httpService
|
return a.srv.HTTPService
|
||||||
}
|
}
|
||||||
func (a *App) ImageProxy() *imageproxy.ImageProxy {
|
func (a *App) ImageProxy() *imageproxy.ImageProxy {
|
||||||
return a.imageProxy
|
return a.srv.ImageProxy
|
||||||
}
|
}
|
||||||
func (a *App) Timezones() *timezones.Timezones {
|
func (a *App) Timezones() *timezones.Timezones {
|
||||||
return a.timezones
|
return a.srv.timezones
|
||||||
}
|
}
|
||||||
func (a *App) Context() context.Context {
|
func (a *App) Context() context.Context {
|
||||||
return a.context
|
return a.context
|
||||||
@@ -526,6 +517,8 @@ func (a *App) SetServer(srv *Server) {
|
|||||||
func (a *App) GetT() goi18n.TranslateFunc {
|
func (a *App) GetT() goi18n.TranslateFunc {
|
||||||
return a.t
|
return a.t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: change this to make a server method.
|
||||||
func (a *App) SetLog(l *mlog.Logger) {
|
func (a *App) SetLog(l *mlog.Logger) {
|
||||||
a.log = l
|
a.srv.Log = l
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,6 +296,8 @@ type AppIface interface {
|
|||||||
// the member's group memberships and the configuration of those groups to the syncable. This method should only
|
// the member's group memberships and the configuration of those groups to the syncable. This method should only
|
||||||
// be invoked on group-synced (aka group-constrained) syncables.
|
// be invoked on group-synced (aka group-constrained) syncables.
|
||||||
SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError
|
SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError
|
||||||
|
// TODO: change this to make a server method.
|
||||||
|
SetLog(l *mlog.Logger)
|
||||||
// TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given
|
// TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given
|
||||||
// groups.
|
// groups.
|
||||||
//
|
//
|
||||||
@@ -893,7 +895,6 @@ type AppIface interface {
|
|||||||
SetContext(c context.Context)
|
SetContext(c context.Context)
|
||||||
SetDefaultProfileImage(user *model.User) *model.AppError
|
SetDefaultProfileImage(user *model.User) *model.AppError
|
||||||
SetIpAddress(s string)
|
SetIpAddress(s string)
|
||||||
SetLog(l *mlog.Logger)
|
|
||||||
SetPath(s string)
|
SetPath(s string)
|
||||||
SetPhase2PermissionsMigrationStatus(isComplete bool) error
|
SetPhase2PermissionsMigrationStatus(isComplete bool) error
|
||||||
SetPluginKey(pluginId string, key string, value []byte) *model.AppError
|
SetPluginKey(pluginId string, key string, value []byte) *model.AppError
|
||||||
|
|||||||
@@ -97,18 +97,6 @@ type AppOptionCreator func() []AppOption
|
|||||||
func ServerConnector(s *Server) AppOption {
|
func ServerConnector(s *Server) AppOption {
|
||||||
return func(a *App) {
|
return func(a *App) {
|
||||||
a.srv = s
|
a.srv = s
|
||||||
a.log = s.Log
|
|
||||||
a.notificationsLog = s.NotificationsLog
|
|
||||||
|
|
||||||
a.cluster = s.Cluster
|
|
||||||
a.compliance = s.Compliance
|
|
||||||
a.dataRetention = s.DataRetention
|
|
||||||
a.searchEngine = s.SearchEngine
|
a.searchEngine = s.SearchEngine
|
||||||
a.messageExport = s.MessageExport
|
|
||||||
a.metrics = s.Metrics
|
|
||||||
|
|
||||||
a.httpService = s.HTTPService
|
|
||||||
a.imageProxy = s.ImageProxy
|
|
||||||
a.timezones = s.timezones
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ func (a *App) TestElasticsearch(cfg *model.Config) *model.AppError {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) SetSearchEngine(se *searchengine.Broker) {
|
||||||
|
a.searchEngine = se
|
||||||
|
}
|
||||||
|
|
||||||
func (a *App) PurgeElasticsearchIndexes() *model.AppError {
|
func (a *App) PurgeElasticsearchIndexes() *model.AppError {
|
||||||
engine := a.SearchEngine().ElasticsearchEngine
|
engine := a.SearchEngine().ElasticsearchEngine
|
||||||
if engine == nil {
|
if engine == nil {
|
||||||
@@ -56,7 +60,3 @@ func (a *App) PurgeBleveIndexes() *model.AppError {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) SetSearchEngine(se *searchengine.Broker) {
|
|
||||||
a.searchEngine = se
|
|
||||||
}
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user