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>
Этот коммит содержится в:
Agniva De Sarker
2020-09-16 21:46:44 +05:30
коммит произвёл GitHub
родитель f0fc51244c
Коммит b329635b23
4 изменённых файлов: 23 добавлений и 41 удалений

Просмотреть файл

@@ -27,8 +27,10 @@ import (
type App struct {
srv *Server
log *mlog.Logger
notificationsLog *mlog.Logger
// XXX: This is required because removing this needs BleveEngine
// 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
session model.Session
@@ -38,17 +40,6 @@ type App struct {
userAgent 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
}
@@ -426,10 +417,10 @@ func (a *App) Srv() *Server {
return a.srv
}
func (a *App) Log() *mlog.Logger {
return a.log
return a.srv.Log
}
func (a *App) NotificationsLog() *mlog.Logger {
return a.notificationsLog
return a.srv.NotificationsLog
}
func (a *App) T(translationID string, args ...interface{}) string {
return a.t(translationID, args...)
@@ -456,13 +447,13 @@ func (a *App) AccountMigration() einterfaces.AccountMigrationInterface {
return a.srv.AccountMigration
}
func (a *App) Cluster() einterfaces.ClusterInterface {
return a.cluster
return a.srv.Cluster
}
func (a *App) Compliance() einterfaces.ComplianceInterface {
return a.compliance
return a.srv.Compliance
}
func (a *App) DataRetention() einterfaces.DataRetentionInterface {
return a.dataRetention
return a.srv.DataRetention
}
func (a *App) SearchEngine() *searchengine.Broker {
return a.searchEngine
@@ -471,10 +462,10 @@ func (a *App) Ldap() einterfaces.LdapInterface {
return a.srv.Ldap
}
func (a *App) MessageExport() einterfaces.MessageExportInterface {
return a.messageExport
return a.srv.MessageExport
}
func (a *App) Metrics() einterfaces.MetricsInterface {
return a.metrics
return a.srv.Metrics
}
func (a *App) Notification() einterfaces.NotificationInterface {
return a.srv.Notification
@@ -483,13 +474,13 @@ func (a *App) Saml() einterfaces.SamlInterface {
return a.srv.Saml
}
func (a *App) HTTPService() httpservice.HTTPService {
return a.httpService
return a.srv.HTTPService
}
func (a *App) ImageProxy() *imageproxy.ImageProxy {
return a.imageProxy
return a.srv.ImageProxy
}
func (a *App) Timezones() *timezones.Timezones {
return a.timezones
return a.srv.timezones
}
func (a *App) Context() context.Context {
return a.context
@@ -526,6 +517,8 @@ func (a *App) SetServer(srv *Server) {
func (a *App) GetT() goi18n.TranslateFunc {
return a.t
}
// TODO: change this to make a server method.
func (a *App) SetLog(l *mlog.Logger) {
a.log = l
a.srv.Log = l
}