summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-09-19 18:31:35 -0500
committerGitHub <noreply@github.com>2017-09-19 18:31:35 -0500
commitac74066f0e4f3d62f2d4645c3fa34b88c13958d1 (patch)
tree9e1cb80eae1b4a2e9dcc2272744c4a9db1b4b804 /api4
parent7e4ff6adcccc4cc5a8fb8cfa853417ec52bf78f4 (diff)
downloadchat-ac74066f0e4f3d62f2d4645c3fa34b88c13958d1.tar.gz
chat-ac74066f0e4f3d62f2d4645c3fa34b88c13958d1.tar.bz2
chat-ac74066f0e4f3d62f2d4645c3fa34b88c13958d1.zip
remove einterface gets (#7455)
Diffstat (limited to 'api4')
-rw-r--r--api4/brand.go4
-rw-r--r--api4/cluster.go2
-rw-r--r--api4/context.go11
-rw-r--r--api4/elasticsearch.go4
-rw-r--r--api4/ldap.go4
-rw-r--r--api4/saml.go2
-rw-r--r--api4/system.go10
-rw-r--r--api4/system_test.go3
-rw-r--r--api4/user.go2
9 files changed, 20 insertions, 22 deletions
diff --git a/api4/brand.go b/api4/brand.go
index bc1ddd2cc..ef4ea25b5 100644
--- a/api4/brand.go
+++ b/api4/brand.go
@@ -22,7 +22,7 @@ func InitBrand() {
func getBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
// No permission check required
- if img, err := app.GetBrandImage(); err != nil {
+ if img, err := c.App.GetBrandImage(); err != nil {
w.WriteHeader(http.StatusNotFound)
w.Write(nil)
} else {
@@ -60,7 +60,7 @@ func uploadBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if err := app.SaveBrandImage(imageArray[0]); err != nil {
+ if err := c.App.SaveBrandImage(imageArray[0]); err != nil {
c.Err = err
return
}
diff --git a/api4/cluster.go b/api4/cluster.go
index 0b119ad1a..c802d2a7e 100644
--- a/api4/cluster.go
+++ b/api4/cluster.go
@@ -24,6 +24,6 @@ func getClusterStatus(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- infos := app.GetClusterStatus()
+ infos := c.App.GetClusterStatus()
w.Write([]byte(model.ClusterInfosToJson(infos)))
}
diff --git a/api4/context.go b/api4/context.go
index 04eb9bbc3..cd32bc7b1 100644
--- a/api4/context.go
+++ b/api4/context.go
@@ -14,7 +14,6 @@ import (
goi18n "github.com/nicksnyder/go-i18n/i18n"
"github.com/mattermost/mattermost-server/app"
- "github.com/mattermost/mattermost-server/einterfaces"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
@@ -184,17 +183,17 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(c.Err.StatusCode)
w.Write([]byte(c.Err.ToJson()))
- if einterfaces.GetMetricsInterface() != nil {
- einterfaces.GetMetricsInterface().IncrementHttpError()
+ if c.App.Metrics != nil {
+ c.App.Metrics.IncrementHttpError()
}
}
- if einterfaces.GetMetricsInterface() != nil {
- einterfaces.GetMetricsInterface().IncrementHttpRequest()
+ if c.App.Metrics != nil {
+ c.App.Metrics.IncrementHttpRequest()
if r.URL.Path != model.API_URL_SUFFIX+"/websocket" {
elapsed := float64(time.Since(now)) / float64(time.Second)
- einterfaces.GetMetricsInterface().ObserveHttpRequestDuration(elapsed)
+ c.App.Metrics.ObserveHttpRequestDuration(elapsed)
}
}
}
diff --git a/api4/elasticsearch.go b/api4/elasticsearch.go
index c4d059af9..cfa8292b6 100644
--- a/api4/elasticsearch.go
+++ b/api4/elasticsearch.go
@@ -30,7 +30,7 @@ func testElasticsearch(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if err := app.TestElasticsearch(cfg); err != nil {
+ if err := c.App.TestElasticsearch(cfg); err != nil {
c.Err = err
return
}
@@ -44,7 +44,7 @@ func purgeElasticsearchIndexes(c *Context, w http.ResponseWriter, r *http.Reques
return
}
- if err := app.PurgeElasticsearchIndexes(); err != nil {
+ if err := c.App.PurgeElasticsearchIndexes(); err != nil {
c.Err = err
return
}
diff --git a/api4/ldap.go b/api4/ldap.go
index 84c0eff28..6ed581783 100644
--- a/api4/ldap.go
+++ b/api4/ldap.go
@@ -25,7 +25,7 @@ func syncLdap(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- app.SyncLdap()
+ c.App.SyncLdap()
ReturnStatusOK(w)
}
@@ -36,7 +36,7 @@ func testLdap(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if err := app.TestLdap(); err != nil {
+ if err := c.App.TestLdap(); err != nil {
c.Err = err
return
}
diff --git a/api4/saml.go b/api4/saml.go
index d16bef787..0fae1965b 100644
--- a/api4/saml.go
+++ b/api4/saml.go
@@ -30,7 +30,7 @@ func InitSaml() {
}
func getSamlMetadata(c *Context, w http.ResponseWriter, r *http.Request) {
- metadata, err := app.GetSamlMetadata()
+ metadata, err := c.App.GetSamlMetadata()
if err != nil {
c.Err = err
return
diff --git a/api4/system.go b/api4/system.go
index b50dc97a5..766ea09ee 100644
--- a/api4/system.go
+++ b/api4/system.go
@@ -94,7 +94,7 @@ func getConfig(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- cfg := app.GetConfig()
+ cfg := c.App.GetConfig()
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Write([]byte(cfg.ToJson()))
@@ -106,7 +106,7 @@ func configReload(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- app.ReloadConfig()
+ c.App.ReloadConfig()
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
ReturnStatusOK(w)
@@ -124,7 +124,7 @@ func updateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- err := app.SaveConfig(cfg, true)
+ err := c.App.SaveConfig(cfg, true)
if err != nil {
c.Err = err
return
@@ -132,7 +132,7 @@ func updateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("updateConfig")
- cfg = app.GetConfig()
+ cfg = c.App.GetConfig()
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Write([]byte(cfg.ToJson()))
@@ -188,7 +188,7 @@ func getLogs(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- lines, err := app.GetLogs(c.Params.Page, c.Params.PerPage)
+ lines, err := c.App.GetLogs(c.Params.Page, c.Params.PerPage)
if err != nil {
c.Err = err
return
diff --git a/api4/system_test.go b/api4/system_test.go
index c960f8689..426752b58 100644
--- a/api4/system_test.go
+++ b/api4/system_test.go
@@ -6,7 +6,6 @@ import (
"testing"
l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
@@ -108,7 +107,7 @@ func TestUpdateConfig(t *testing.T) {
defer TearDown()
Client := th.Client
- cfg := app.GetConfig()
+ cfg := th.App.GetConfig()
_, resp := Client.UpdateConfig(cfg)
CheckForbiddenStatus(t, resp)
diff --git a/api4/user.go b/api4/user.go
index cb1ae0fa3..e62091320 100644
--- a/api4/user.go
+++ b/api4/user.go
@@ -947,7 +947,7 @@ func attachDeviceId(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- app.ClearSessionCacheForUser(c.Session.UserId)
+ c.App.ClearSessionCacheForUser(c.Session.UserId)
c.Session.SetExpireInDays(*utils.Cfg.ServiceSettings.SessionLengthMobileInDays)
maxAge := *utils.Cfg.ServiceSettings.SessionLengthMobileInDays * 60 * 60 * 24