Remove all remaining occurences of fakeApp (#17661)

* Remove all remaining occurences of fakeApp

Migrated any remaining methods under server.

And for everything else, renamed fakeApp to app.
The word fakeApp is confusing and we should just call
it for what it is - an app.

https://focalboard-community.octo.mattermost.com/workspace/zyoahc9uapdn3xdptac6jb69ic?id=285b80a3-257d-41f6-8cf4-ed80ca9d92e5&v=495cdb4d-c13a-4992-8eb9-80cfee2819a4&c=639a0bc1-4401-43d5-81ec-0dd54e796d9a

```release-note
NONE
```

* fix tests
Этот коммит содержится в:
Agniva De Sarker
2021-05-24 10:24:51 +05:30
коммит произвёл GitHub
родитель 0bc065d147
Коммит a4f7df6f6e
8 изменённых файлов: 31 добавлений и 70 удалений

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

@@ -248,8 +248,8 @@ func NewServer(options ...Option) (*Server, error) {
// It is important to initialize the hub only after the global logger is set
// to avoid race conditions while logging from inside the hub.
fakeApp := New(ServerConnector(s))
fakeApp.HubStart()
app := New(ServerConnector(s))
app.HubStart()
if *s.Config().LogSettings.EnableDiagnostics && *s.Config().LogSettings.EnableSentry {
if strings.Contains(SentryDSN, "placeholder") {
@@ -489,11 +489,10 @@ func NewServer(options ...Option) (*Server, error) {
}
s.Router = s.RootRouter.PathPrefix(subpath).Subrouter()
// FakeApp: remove this when we have the ServePluginRequest and ServePluginPublicRequest migrated in the server
pluginsRoute := s.Router.PathPrefix("/plugins/{plugin_id:[A-Za-z0-9\\_\\-\\.]+}").Subrouter()
pluginsRoute.HandleFunc("", fakeApp.ServePluginRequest)
pluginsRoute.HandleFunc("/public/{public_file:.*}", fakeApp.ServePluginPublicRequest)
pluginsRoute.HandleFunc("/{anything:.*}", fakeApp.ServePluginRequest)
pluginsRoute.HandleFunc("", s.ServePluginRequest)
pluginsRoute.HandleFunc("/public/{public_file:.*}", s.ServePluginPublicRequest)
pluginsRoute.HandleFunc("/{anything:.*}", s.ServePluginRequest)
// If configured with a subpath, redirect 404s at the root back into the subpath.
if subpath != "/" {
@@ -505,7 +504,7 @@ func NewServer(options ...Option) (*Server, error) {
s.WebSocketRouter = &WebSocketRouter{
handlers: make(map[string]webSocketHandler),
app: fakeApp,
app: app,
}
mailConfig := s.MailServiceConfig()
@@ -634,7 +633,7 @@ func NewServer(options ...Option) (*Server, error) {
// if enabled - perform initial product notices fetch
if *s.Config().AnnouncementSettings.AdminNoticesEnabled || *s.Config().AnnouncementSettings.UserNoticesEnabled {
go func() {
if err := fakeApp.UpdateProductNotices(); err != nil {
if err := app.UpdateProductNotices(); err != nil {
mlog.Warn("Failied to perform initial product notices fetch", mlog.Err(err))
}
}()
@@ -647,7 +646,7 @@ func NewServer(options ...Option) (*Server, error) {
c := request.EmptyContext()
s.AddConfigListener(func(oldConfig *model.Config, newConfig *model.Config) {
if *oldConfig.GuestAccountsSettings.Enable && !*newConfig.GuestAccountsSettings.Enable {
if appErr := fakeApp.DeactivateGuests(c); appErr != nil {
if appErr := app.DeactivateGuests(c); appErr != nil {
mlog.Error("Unable to deactivate guest accounts", mlog.Err(appErr))
}
}
@@ -655,7 +654,7 @@ func NewServer(options ...Option) (*Server, error) {
// Disable active guest accounts on first run if guest accounts are disabled
if !*s.Config().GuestAccountsSettings.Enable {
if appErr := fakeApp.DeactivateGuests(c); appErr != nil {
if appErr := app.DeactivateGuests(c); appErr != nil {
mlog.Error("Unable to deactivate guest accounts", mlog.Err(appErr))
}
}
@@ -663,8 +662,8 @@ func NewServer(options ...Option) (*Server, error) {
if s.runEssentialJobs {
s.Go(func() {
s.runLicenseExpirationCheckJob()
runCheckAdminSupportStatusJob(fakeApp, c)
runCheckWarnMetricStatusJob(fakeApp, c)
runCheckAdminSupportStatusJob(app, c)
runCheckWarnMetricStatusJob(app, c)
})
s.runJobs()
}