summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/admin.go4
-rw-r--r--api/api.go1
-rw-r--r--api/apitestlib.go2
-rw-r--r--api/channel.go2
-rw-r--r--api/command.go5
-rw-r--r--api/deprecated.go15
-rw-r--r--api/emoji.go4
-rw-r--r--api/file.go3
-rw-r--r--api/general.go4
-rw-r--r--api/general_test.go3
-rw-r--r--api/license.go3
-rw-r--r--api/oauth.go4
-rw-r--r--api/post.go3
-rw-r--r--api/preference.go4
-rw-r--r--api/reaction.go4
-rw-r--r--api/status.go5
-rw-r--r--api/team.go3
-rw-r--r--api/user.go2
-rw-r--r--api/webhook.go4
-rw-r--r--api/webrtc.go5
-rw-r--r--api/websocket.go1
-rw-r--r--api4/apitestlib.go2
-rw-r--r--api4/brand.go4
-rw-r--r--api4/channel.go3
-rw-r--r--api4/cluster.go4
-rw-r--r--api4/command.go4
-rw-r--r--api4/compliance.go4
-rw-r--r--api4/data_retention.go6
-rw-r--r--api4/elasticsearch.go4
-rw-r--r--api4/emoji.go5
-rw-r--r--api4/file.go3
-rw-r--r--api4/job.go3
-rw-r--r--api4/ldap.go4
-rw-r--r--api4/oauth.go2
-rw-r--r--api4/openGraph.go3
-rw-r--r--api4/openGraph_test.go3
-rw-r--r--api4/post.go5
-rw-r--r--api4/preference.go4
-rw-r--r--api4/reaction.go4
-rw-r--r--api4/saml.go4
-rw-r--r--api4/status.go5
-rw-r--r--api4/system.go2
-rw-r--r--api4/team.go4
-rw-r--r--api4/user.go2
-rw-r--r--api4/webhook.go3
-rw-r--r--api4/webrtc.go5
-rw-r--r--api4/webrtc_test.go3
-rw-r--r--api4/websocket.go2
-rw-r--r--app/apptestlib.go2
-rw-r--r--store/storetest/user_store.go3
-rw-r--r--wsapi/status.go3
-rw-r--r--wsapi/system.go4
-rw-r--r--wsapi/user.go4
-rw-r--r--wsapi/webrtc.go4
54 files changed, 8 insertions, 190 deletions
diff --git a/api/admin.go b/api/admin.go
index 63f27d64e..b3b74d5ea 100644
--- a/api/admin.go
+++ b/api/admin.go
@@ -7,17 +7,13 @@ import (
"net/http"
"strconv"
- l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
"github.com/mssola/user_agent"
)
func (api *API) InitAdmin() {
- l4g.Debug(utils.T("api.admin.init.debug"))
-
api.BaseRoutes.Admin.Handle("/logs", api.ApiAdminSystemRequired(getLogs)).Methods("GET")
api.BaseRoutes.Admin.Handle("/audits", api.ApiAdminSystemRequired(getAllAudits)).Methods("GET")
api.BaseRoutes.Admin.Handle("/config", api.ApiAdminSystemRequired(getConfig)).Methods("GET")
diff --git a/api/api.go b/api/api.go
index 44651b1fa..2d65bb216 100644
--- a/api/api.go
+++ b/api/api.go
@@ -107,7 +107,6 @@ func Init(a *app.App, root *mux.Router) *API {
api.InitStatus()
api.InitWebrtc()
api.InitReaction()
- api.InitDeprecated()
// 404 on any api route before web.go has a chance to serve it
root.Handle("/api/{anything:.*}", http.HandlerFunc(Handle404))
diff --git a/api/apitestlib.go b/api/apitestlib.go
index a2b7e8741..547071e93 100644
--- a/api/apitestlib.go
+++ b/api/apitestlib.go
@@ -79,7 +79,6 @@ func setupTestHelper(enterprise bool) *TestHelper {
*cfg.RateLimitSettings.Enable = false
cfg.EmailSettings.SendEmailNotifications = true
})
- utils.DisableDebugLogForTest()
prevListenAddress := *th.App.Config().ServiceSettings.ListenAddress
if testStore != nil {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = ":0" })
@@ -89,7 +88,6 @@ func setupTestHelper(enterprise bool) *TestHelper {
api4.Init(th.App, th.App.Srv.Router, false)
Init(th.App, th.App.Srv.Router)
wsapi.Init(th.App, th.App.Srv.WebSocketRouter)
- utils.EnableDebugLogForTest()
th.App.Srv.Store.MarkSystemRanUnitTests()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableOpenServer = true })
diff --git a/api/channel.go b/api/channel.go
index 2782f9636..976007725 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -14,8 +14,6 @@ import (
)
func (api *API) InitChannel() {
- l4g.Debug(utils.T("api.channel.init.debug"))
-
api.BaseRoutes.Channels.Handle("/", api.ApiUserRequired(getChannels)).Methods("GET")
api.BaseRoutes.Channels.Handle("/more/{offset:[0-9]+}/{limit:[0-9]+}", api.ApiUserRequired(getMoreChannelsPage)).Methods("GET")
api.BaseRoutes.Channels.Handle("/more/search", api.ApiUserRequired(searchMoreChannels)).Methods("POST")
diff --git a/api/command.go b/api/command.go
index 321a67dfc..bbc7fbebd 100644
--- a/api/command.go
+++ b/api/command.go
@@ -8,15 +8,10 @@ import (
"net/http"
"strings"
- l4g "github.com/alecthomas/log4go"
-
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitCommand() {
- l4g.Debug(utils.T("api.command.init.debug"))
-
api.BaseRoutes.Commands.Handle("/execute", api.ApiUserRequired(executeCommand)).Methods("POST")
api.BaseRoutes.Commands.Handle("/list", api.ApiUserRequired(listCommands)).Methods("GET")
diff --git a/api/deprecated.go b/api/deprecated.go
deleted file mode 100644
index f62af84de..000000000
--- a/api/deprecated.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package api
-
-import (
- l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/mattermost-server/utils"
-)
-
-// ONLY FOR APIs SCHEDULED TO BE DEPRECATED
-
-func (api *API) InitDeprecated() {
- l4g.Debug(utils.T("api.deprecated.init.debug"))
-}
diff --git a/api/emoji.go b/api/emoji.go
index cbe7b07bf..ed21e2192 100644
--- a/api/emoji.go
+++ b/api/emoji.go
@@ -12,17 +12,13 @@ import (
"image/color/palette"
- l4g "github.com/alecthomas/log4go"
"github.com/disintegration/imaging"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitEmoji() {
- l4g.Debug(utils.T("api.emoji.init.debug"))
-
api.BaseRoutes.Emoji.Handle("/list", api.ApiUserRequired(getEmoji)).Methods("GET")
api.BaseRoutes.Emoji.Handle("/create", api.ApiUserRequired(createEmoji)).Methods("POST")
api.BaseRoutes.Emoji.Handle("/delete", api.ApiUserRequired(deleteEmoji)).Methods("POST")
diff --git a/api/file.go b/api/file.go
index 75739486c..2d626304e 100644
--- a/api/file.go
+++ b/api/file.go
@@ -9,7 +9,6 @@ import (
"strconv"
"strings"
- l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/model"
@@ -31,8 +30,6 @@ var UNSAFE_CONTENT_TYPES = [...]string{
}
func (api *API) InitFile() {
- l4g.Debug(utils.T("api.file.init.debug"))
-
api.BaseRoutes.TeamFiles.Handle("/upload", api.ApiUserRequired(uploadFile)).Methods("POST")
api.BaseRoutes.NeedFile.Handle("/get", api.ApiUserRequiredTrustRequester(getFile)).Methods("GET")
diff --git a/api/general.go b/api/general.go
index 3091c1169..0fd289ffb 100644
--- a/api/general.go
+++ b/api/general.go
@@ -8,15 +8,11 @@ import (
"net/http"
"strings"
- l4g "github.com/alecthomas/log4go"
-
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitGeneral() {
- l4g.Debug(utils.T("api.general.init.debug"))
-
api.BaseRoutes.General.Handle("/client_props", api.ApiAppHandler(getClientConfig)).Methods("GET")
api.BaseRoutes.General.Handle("/log_client", api.ApiAppHandler(logClient)).Methods("POST")
api.BaseRoutes.General.Handle("/ping", api.ApiAppHandler(ping)).Methods("GET")
diff --git a/api/general_test.go b/api/general_test.go
index 3f61d9d32..5b0a2630f 100644
--- a/api/general_test.go
+++ b/api/general_test.go
@@ -4,8 +4,9 @@
package api
import (
- "github.com/mattermost/mattermost-server/model"
"testing"
+
+ "github.com/mattermost/mattermost-server/model"
)
func TestGetClientProperties(t *testing.T) {
diff --git a/api/license.go b/api/license.go
index a6a167cac..8eb7803e1 100644
--- a/api/license.go
+++ b/api/license.go
@@ -8,14 +8,11 @@ import (
"io"
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitLicense() {
- l4g.Debug(utils.T("api.license.init.debug"))
-
api.BaseRoutes.License.Handle("/add", api.ApiAdminSystemRequired(addLicense)).Methods("POST")
api.BaseRoutes.License.Handle("/remove", api.ApiAdminSystemRequired(removeLicense)).Methods("POST")
api.BaseRoutes.License.Handle("/client_config", api.ApiAppHandler(getClientLicenceConfig)).Methods("GET")
diff --git a/api/oauth.go b/api/oauth.go
index c8a228a7b..2fc83d122 100644
--- a/api/oauth.go
+++ b/api/oauth.go
@@ -6,15 +6,11 @@ package api
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitOAuth() {
- l4g.Debug(utils.T("api.oauth.init.debug"))
-
api.BaseRoutes.OAuth.Handle("/register", api.ApiUserRequired(registerOAuthApp)).Methods("POST")
api.BaseRoutes.OAuth.Handle("/list", api.ApiUserRequired(getOAuthApps)).Methods("GET")
api.BaseRoutes.OAuth.Handle("/app/{client_id}", api.ApiUserRequired(getOAuthAppInfo)).Methods("GET")
diff --git a/api/post.go b/api/post.go
index 1e09971b6..e0cfb720c 100644
--- a/api/post.go
+++ b/api/post.go
@@ -8,7 +8,6 @@ import (
"strconv"
"time"
- l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/model"
@@ -20,8 +19,6 @@ const OPEN_GRAPH_METADATA_CACHE_SIZE = 10000
var openGraphDataCache = utils.NewLru(OPEN_GRAPH_METADATA_CACHE_SIZE)
func (api *API) InitPost() {
- l4g.Debug(utils.T("api.post.init.debug"))
-
api.BaseRoutes.ApiRoot.Handle("/get_opengraph_metadata", api.ApiUserRequired(getOpenGraphMetadata)).Methods("POST")
api.BaseRoutes.NeedTeam.Handle("/posts/search", api.ApiUserRequiredActivity(searchPosts, true)).Methods("POST")
diff --git a/api/preference.go b/api/preference.go
index f4d7d2842..8de1ea453 100644
--- a/api/preference.go
+++ b/api/preference.go
@@ -6,15 +6,11 @@ package api
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitPreference() {
- l4g.Debug(utils.T("api.preference.init.debug"))
-
api.BaseRoutes.Preferences.Handle("/", api.ApiUserRequired(getAllPreferences)).Methods("GET")
api.BaseRoutes.Preferences.Handle("/save", api.ApiUserRequired(savePreferences)).Methods("POST")
api.BaseRoutes.Preferences.Handle("/delete", api.ApiUserRequired(deletePreferences)).Methods("POST")
diff --git a/api/reaction.go b/api/reaction.go
index aada8cdd4..991044cda 100644
--- a/api/reaction.go
+++ b/api/reaction.go
@@ -6,15 +6,11 @@ package api
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitReaction() {
- l4g.Debug(utils.T("api.reaction.init.debug"))
-
api.BaseRoutes.NeedPost.Handle("/reactions/save", api.ApiUserRequired(saveReaction)).Methods("POST")
api.BaseRoutes.NeedPost.Handle("/reactions/delete", api.ApiUserRequired(deleteReaction)).Methods("POST")
api.BaseRoutes.NeedPost.Handle("/reactions", api.ApiUserRequired(listReactions)).Methods("GET")
diff --git a/api/status.go b/api/status.go
index a86d80f98..e1e4de522 100644
--- a/api/status.go
+++ b/api/status.go
@@ -6,15 +6,10 @@ package api
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
-
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitStatus() {
- l4g.Debug(utils.T("api.status.init.debug"))
-
api.BaseRoutes.Users.Handle("/status", api.ApiUserRequired(getStatusesHttp)).Methods("GET")
api.BaseRoutes.Users.Handle("/status/ids", api.ApiUserRequired(getStatusesByIdsHttp)).Methods("POST")
}
diff --git a/api/team.go b/api/team.go
index ce58aaaa5..48377f970 100644
--- a/api/team.go
+++ b/api/team.go
@@ -10,7 +10,6 @@ import (
"strconv"
"strings"
- l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/model"
@@ -18,8 +17,6 @@ import (
)
func (api *API) InitTeam() {
- l4g.Debug(utils.T("api.team.init.debug"))
-
api.BaseRoutes.Teams.Handle("/create", api.ApiUserRequired(createTeam)).Methods("POST")
api.BaseRoutes.Teams.Handle("/all", api.ApiUserRequired(getAll)).Methods("GET")
api.BaseRoutes.Teams.Handle("/all_team_listings", api.ApiUserRequired(GetAllTeamListings)).Methods("GET")
diff --git a/api/user.go b/api/user.go
index 5aba61e38..f9b0af469 100644
--- a/api/user.go
+++ b/api/user.go
@@ -20,8 +20,6 @@ import (
)
func (api *API) InitUser() {
- l4g.Debug(utils.T("api.user.init.debug"))
-
api.BaseRoutes.Users.Handle("/create", api.ApiAppHandler(createUser)).Methods("POST")
api.BaseRoutes.Users.Handle("/update", api.ApiUserRequired(updateUser)).Methods("POST")
api.BaseRoutes.Users.Handle("/update_active", api.ApiUserRequired(updateActive)).Methods("POST")
diff --git a/api/webhook.go b/api/webhook.go
index dce5ddc1e..e3e12816a 100644
--- a/api/webhook.go
+++ b/api/webhook.go
@@ -6,14 +6,10 @@ package api
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitWebhook() {
- l4g.Debug(utils.T("api.webhook.init.debug"))
-
api.BaseRoutes.Hooks.Handle("/incoming/create", api.ApiUserRequired(createIncomingHook)).Methods("POST")
api.BaseRoutes.Hooks.Handle("/incoming/update", api.ApiUserRequired(updateIncomingHook)).Methods("POST")
api.BaseRoutes.Hooks.Handle("/incoming/delete", api.ApiUserRequired(deleteIncomingHook)).Methods("POST")
diff --git a/api/webrtc.go b/api/webrtc.go
index 92c44159f..cd37c0ad8 100644
--- a/api/webrtc.go
+++ b/api/webrtc.go
@@ -5,14 +5,9 @@ package api
import (
"net/http"
-
- l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitWebrtc() {
- l4g.Debug(utils.T("api.webrtc.init.debug"))
-
api.BaseRoutes.Webrtc.Handle("/token", api.ApiUserRequired(webrtcToken)).Methods("POST")
}
diff --git a/api/websocket.go b/api/websocket.go
index 518f81d58..0da18d896 100644
--- a/api/websocket.go
+++ b/api/websocket.go
@@ -13,7 +13,6 @@ import (
)
func (api *API) InitWebSocket() {
- l4g.Debug(utils.T("api.web_socket.init.debug"))
api.BaseRoutes.Users.Handle("/websocket", api.ApiAppHandlerTrustRequester(connect)).Methods("GET")
}
diff --git a/api4/apitestlib.go b/api4/apitestlib.go
index f08e5d1ef..eab27173f 100644
--- a/api4/apitestlib.go
+++ b/api4/apitestlib.go
@@ -88,7 +88,6 @@ func setupTestHelper(enterprise bool) *TestHelper {
*cfg.RateLimitSettings.Enable = false
cfg.EmailSettings.SendEmailNotifications = true
})
- utils.DisableDebugLogForTest()
prevListenAddress := *th.App.Config().ServiceSettings.ListenAddress
if testStore != nil {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = ":0" })
@@ -97,7 +96,6 @@ func setupTestHelper(enterprise bool) *TestHelper {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = prevListenAddress })
Init(th.App, th.App.Srv.Router, true)
wsapi.Init(th.App, th.App.Srv.WebSocketRouter)
- utils.EnableDebugLogForTest()
th.App.Srv.Store.MarkSystemRanUnitTests()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableOpenServer = true })
diff --git a/api4/brand.go b/api4/brand.go
index ee48953dd..f182e1070 100644
--- a/api4/brand.go
+++ b/api4/brand.go
@@ -6,14 +6,10 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitBrand() {
- l4g.Debug(utils.T("api.brand.init.debug"))
-
api.BaseRoutes.Brand.Handle("/image", api.ApiHandlerTrustRequester(getBrandImage)).Methods("GET")
api.BaseRoutes.Brand.Handle("/image", api.ApiSessionRequired(uploadBrandImage)).Methods("POST")
}
diff --git a/api4/channel.go b/api4/channel.go
index f96942a4f..f8a069ea0 100644
--- a/api4/channel.go
+++ b/api4/channel.go
@@ -8,12 +8,9 @@ import (
l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitChannel() {
- l4g.Debug(utils.T("api.channel.init.debug"))
-
api.BaseRoutes.Channels.Handle("", api.ApiSessionRequired(createChannel)).Methods("POST")
api.BaseRoutes.Channels.Handle("/direct", api.ApiSessionRequired(createDirectChannel)).Methods("POST")
api.BaseRoutes.Channels.Handle("/group", api.ApiSessionRequired(createGroupChannel)).Methods("POST")
diff --git a/api4/cluster.go b/api4/cluster.go
index 472b52f36..375e1bd0c 100644
--- a/api4/cluster.go
+++ b/api4/cluster.go
@@ -6,14 +6,10 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitCluster() {
- l4g.Debug(utils.T("api.cluster.init.debug"))
-
api.BaseRoutes.Cluster.Handle("/status", api.ApiSessionRequired(getClusterStatus)).Methods("GET")
}
diff --git a/api4/command.go b/api4/command.go
index c92eb277a..3ab2839ba 100644
--- a/api4/command.go
+++ b/api4/command.go
@@ -9,14 +9,10 @@ import (
"strconv"
"strings"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitCommand() {
- l4g.Debug(utils.T("api.command.init.debug"))
-
api.BaseRoutes.Commands.Handle("", api.ApiSessionRequired(createCommand)).Methods("POST")
api.BaseRoutes.Commands.Handle("", api.ApiSessionRequired(listCommands)).Methods("GET")
api.BaseRoutes.Commands.Handle("/execute", api.ApiSessionRequired(executeCommand)).Methods("POST")
diff --git a/api4/compliance.go b/api4/compliance.go
index d58398595..71f0fa81d 100644
--- a/api4/compliance.go
+++ b/api4/compliance.go
@@ -7,15 +7,11 @@ import (
"net/http"
"strconv"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
"github.com/mssola/user_agent"
)
func (api *API) InitCompliance() {
- l4g.Debug(utils.T("api.compliance.init.debug"))
-
api.BaseRoutes.Compliance.Handle("/reports", api.ApiSessionRequired(createComplianceReport)).Methods("POST")
api.BaseRoutes.Compliance.Handle("/reports", api.ApiSessionRequired(getComplianceReports)).Methods("GET")
api.BaseRoutes.Compliance.Handle("/reports/{report_id:[A-Za-z0-9]+}", api.ApiSessionRequired(getComplianceReport)).Methods("GET")
diff --git a/api4/data_retention.go b/api4/data_retention.go
index da0d5812e..8c42473e6 100644
--- a/api4/data_retention.go
+++ b/api4/data_retention.go
@@ -5,15 +5,9 @@ package api4
import (
"net/http"
-
- l4g "github.com/alecthomas/log4go"
-
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitDataRetention() {
- l4g.Debug(utils.T("api.data_retention.init.debug"))
-
api.BaseRoutes.DataRetention.Handle("/policy", api.ApiSessionRequired(getPolicy)).Methods("GET")
}
diff --git a/api4/elasticsearch.go b/api4/elasticsearch.go
index 6640b0837..7ba88f172 100644
--- a/api4/elasticsearch.go
+++ b/api4/elasticsearch.go
@@ -6,14 +6,10 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitElasticsearch() {
- l4g.Debug(utils.T("api.elasticsearch.init.debug"))
-
api.BaseRoutes.Elasticsearch.Handle("/test", api.ApiSessionRequired(testElasticsearch)).Methods("POST")
api.BaseRoutes.Elasticsearch.Handle("/purge_indexes", api.ApiSessionRequired(purgeElasticsearchIndexes)).Methods("POST")
}
diff --git a/api4/emoji.go b/api4/emoji.go
index e96e0755f..341c565d8 100644
--- a/api4/emoji.go
+++ b/api4/emoji.go
@@ -7,16 +7,11 @@ import (
"net/http"
"strings"
- l4g "github.com/alecthomas/log4go"
-
"github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitEmoji() {
- l4g.Debug(utils.T("api.emoji.init.debug"))
-
api.BaseRoutes.Emojis.Handle("", api.ApiSessionRequired(createEmoji)).Methods("POST")
api.BaseRoutes.Emojis.Handle("", api.ApiSessionRequired(getEmojiList)).Methods("GET")
api.BaseRoutes.Emoji.Handle("", api.ApiSessionRequired(deleteEmoji)).Methods("DELETE")
diff --git a/api4/file.go b/api4/file.go
index 7e13d0290..48ee281fe 100644
--- a/api4/file.go
+++ b/api4/file.go
@@ -9,7 +9,6 @@ import (
"strconv"
"strings"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
@@ -44,8 +43,6 @@ var MEDIA_CONTENT_TYPES = [...]string{
}
func (api *API) InitFile() {
- l4g.Debug(utils.T("api.file.init.debug"))
-
api.BaseRoutes.Files.Handle("", api.ApiSessionRequired(uploadFile)).Methods("POST")
api.BaseRoutes.File.Handle("", api.ApiSessionRequiredTrustRequester(getFile)).Methods("GET")
api.BaseRoutes.File.Handle("/thumbnail", api.ApiSessionRequiredTrustRequester(getFileThumbnail)).Methods("GET")
diff --git a/api4/job.go b/api4/job.go
index 2a5134cd3..864d21bbb 100644
--- a/api4/job.go
+++ b/api4/job.go
@@ -6,13 +6,10 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
)
func (api *API) InitJob() {
- l4g.Info("Initializing job API routes")
-
api.BaseRoutes.Jobs.Handle("", api.ApiSessionRequired(getJobs)).Methods("GET")
api.BaseRoutes.Jobs.Handle("", api.ApiSessionRequired(createJob)).Methods("POST")
api.BaseRoutes.Jobs.Handle("/{job_id:[A-Za-z0-9]+}", api.ApiSessionRequired(getJob)).Methods("GET")
diff --git a/api4/ldap.go b/api4/ldap.go
index 66735c526..b3416ffa1 100644
--- a/api4/ldap.go
+++ b/api4/ldap.go
@@ -6,14 +6,10 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitLdap() {
- l4g.Debug(utils.T("api.ldap.init.debug"))
-
api.BaseRoutes.LDAP.Handle("/sync", api.ApiSessionRequired(syncLdap)).Methods("POST")
api.BaseRoutes.LDAP.Handle("/test", api.ApiSessionRequired(testLdap)).Methods("POST")
}
diff --git a/api4/oauth.go b/api4/oauth.go
index b54a43832..ac293c63e 100644
--- a/api4/oauth.go
+++ b/api4/oauth.go
@@ -15,8 +15,6 @@ import (
)
func (api *API) InitOAuth() {
- l4g.Debug(utils.T("api.oauth.init.debug"))
-
api.BaseRoutes.OAuthApps.Handle("", api.ApiSessionRequired(createOAuthApp)).Methods("POST")
api.BaseRoutes.OAuthApp.Handle("", api.ApiSessionRequired(updateOAuthApp)).Methods("PUT")
api.BaseRoutes.OAuthApps.Handle("", api.ApiSessionRequired(getOAuthApps)).Methods("GET")
diff --git a/api4/openGraph.go b/api4/openGraph.go
index c552b54d9..646cce883 100644
--- a/api4/openGraph.go
+++ b/api4/openGraph.go
@@ -6,7 +6,6 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
@@ -16,8 +15,6 @@ const OPEN_GRAPH_METADATA_CACHE_SIZE = 10000
var openGraphDataCache = utils.NewLru(OPEN_GRAPH_METADATA_CACHE_SIZE)
func (api *API) InitOpenGraph() {
- l4g.Debug(utils.T("api.opengraph.init.debug"))
-
api.BaseRoutes.OpenGraph.Handle("", api.ApiSessionRequired(getOpenGraphMetadata)).Methods("POST")
}
diff --git a/api4/openGraph_test.go b/api4/openGraph_test.go
index 6a14ad943..b7c4fe314 100644
--- a/api4/openGraph_test.go
+++ b/api4/openGraph_test.go
@@ -9,8 +9,9 @@ import (
"net/http/httptest"
"strings"
- "github.com/mattermost/mattermost-server/model"
"testing"
+
+ "github.com/mattermost/mattermost-server/model"
)
func TestGetOpenGraphMetadata(t *testing.T) {
diff --git a/api4/post.go b/api4/post.go
index 6dc3564ff..7a365845f 100644
--- a/api4/post.go
+++ b/api4/post.go
@@ -8,15 +8,10 @@ import (
"strconv"
"time"
- l4g "github.com/alecthomas/log4go"
-
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitPost() {
- l4g.Debug(utils.T("api.post.init.debug"))
-
api.BaseRoutes.Posts.Handle("", api.ApiSessionRequired(createPost)).Methods("POST")
api.BaseRoutes.Post.Handle("", api.ApiSessionRequired(getPost)).Methods("GET")
api.BaseRoutes.Post.Handle("", api.ApiSessionRequired(deletePost)).Methods("DELETE")
diff --git a/api4/preference.go b/api4/preference.go
index ad1eca4c8..c9f0b3af4 100644
--- a/api4/preference.go
+++ b/api4/preference.go
@@ -6,14 +6,10 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitPreference() {
- l4g.Debug(utils.T("api.preference.init.debug"))
-
api.BaseRoutes.Preferences.Handle("", api.ApiSessionRequired(getPreferences)).Methods("GET")
api.BaseRoutes.Preferences.Handle("", api.ApiSessionRequired(updatePreferences)).Methods("PUT")
api.BaseRoutes.Preferences.Handle("/delete", api.ApiSessionRequired(deletePreferences)).Methods("POST")
diff --git a/api4/reaction.go b/api4/reaction.go
index a19b2460a..6208b0aee 100644
--- a/api4/reaction.go
+++ b/api4/reaction.go
@@ -6,14 +6,10 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitReaction() {
- l4g.Debug(utils.T("api.reaction.init.debug"))
-
api.BaseRoutes.Reactions.Handle("", api.ApiSessionRequired(saveReaction)).Methods("POST")
api.BaseRoutes.Post.Handle("/reactions", api.ApiSessionRequired(getReactions)).Methods("GET")
api.BaseRoutes.ReactionByNameForPostForUser.Handle("", api.ApiSessionRequired(deleteReaction)).Methods("DELETE")
diff --git a/api4/saml.go b/api4/saml.go
index 469576943..936e5d958 100644
--- a/api4/saml.go
+++ b/api4/saml.go
@@ -7,14 +7,10 @@ import (
"mime/multipart"
"net/http"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitSaml() {
- l4g.Debug(utils.T("api.saml.init.debug"))
-
api.BaseRoutes.SAML.Handle("/metadata", api.ApiHandler(getSamlMetadata)).Methods("GET")
api.BaseRoutes.SAML.Handle("/certificate/public", api.ApiSessionRequired(addSamlPublicCertificate)).Methods("POST")
diff --git a/api4/status.go b/api4/status.go
index c8690768d..59909e295 100644
--- a/api4/status.go
+++ b/api4/status.go
@@ -6,15 +6,10 @@ package api4
import (
"net/http"
- l4g "github.com/alecthomas/log4go"
-
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitStatus() {
- l4g.Debug(utils.T("api.status.init.debug"))
-
api.BaseRoutes.User.Handle("/status", api.ApiSessionRequired(getUserStatus)).Methods("GET")
api.BaseRoutes.Users.Handle("/status/ids", api.ApiSessionRequired(getUserStatusesByIds)).Methods("POST")
api.BaseRoutes.User.Handle("/status", api.ApiSessionRequired(updateUserStatus)).Methods("PUT")
diff --git a/api4/system.go b/api4/system.go
index 93e9ddcd2..c87527ff0 100644
--- a/api4/system.go
+++ b/api4/system.go
@@ -16,8 +16,6 @@ import (
)
func (api *API) InitSystem() {
- l4g.Debug(utils.T("api.system.init.debug"))
-
api.BaseRoutes.System.Handle("/ping", api.ApiHandler(getSystemPing)).Methods("GET")
api.BaseRoutes.ApiRoot.Handle("/config", api.ApiSessionRequired(getConfig)).Methods("GET")
diff --git a/api4/team.go b/api4/team.go
index e897ea32b..d770aee22 100644
--- a/api4/team.go
+++ b/api4/team.go
@@ -9,9 +9,7 @@ import (
"net/http"
"strconv"
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
const (
@@ -19,8 +17,6 @@ const (
)
func (api *API) InitTeam() {
- l4g.Debug(utils.T("api.team.init.debug"))
-
api.BaseRoutes.Teams.Handle("", api.ApiSessionRequired(createTeam)).Methods("POST")
api.BaseRoutes.Teams.Handle("", api.ApiSessionRequired(getAllTeams)).Methods("GET")
api.BaseRoutes.Teams.Handle("/search", api.ApiSessionRequired(searchTeams)).Methods("POST")
diff --git a/api4/user.go b/api4/user.go
index 4f4185958..6cb064f8c 100644
--- a/api4/user.go
+++ b/api4/user.go
@@ -17,8 +17,6 @@ import (
)
func (api *API) InitUser() {
- l4g.Debug(utils.T("api.user.init.debug"))
-
api.BaseRoutes.Users.Handle("", api.ApiHandler(createUser)).Methods("POST")
api.BaseRoutes.Users.Handle("", api.ApiSessionRequired(getUsers)).Methods("GET")
api.BaseRoutes.Users.Handle("/ids", api.ApiSessionRequired(getUsersByIds)).Methods("POST")
diff --git a/api4/webhook.go b/api4/webhook.go
index 5146024f7..90e32a891 100644
--- a/api4/webhook.go
+++ b/api4/webhook.go
@@ -8,15 +8,12 @@ import (
"net/http"
"strings"
- l4g "github.com/alecthomas/log4go"
"github.com/gorilla/mux"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitWebhook() {
- l4g.Debug(utils.T("api.webhook.init.debug"))
-
api.BaseRoutes.IncomingHooks.Handle("", api.ApiSessionRequired(createIncomingHook)).Methods("POST")
api.BaseRoutes.IncomingHooks.Handle("", api.ApiSessionRequired(getIncomingHooks)).Methods("GET")
api.BaseRoutes.IncomingHook.Handle("", api.ApiSessionRequired(getIncomingHook)).Methods("GET")
diff --git a/api4/webrtc.go b/api4/webrtc.go
index 9fcc18ff9..978342393 100644
--- a/api4/webrtc.go
+++ b/api4/webrtc.go
@@ -5,14 +5,9 @@ package api4
import (
"net/http"
-
- l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitWebrtc() {
- l4g.Debug(utils.T("api.webrtc.init.debug"))
-
api.BaseRoutes.Webrtc.Handle("/token", api.ApiSessionRequired(webrtcToken)).Methods("GET")
}
diff --git a/api4/webrtc_test.go b/api4/webrtc_test.go
index 660bb6f62..4ad20175e 100644
--- a/api4/webrtc_test.go
+++ b/api4/webrtc_test.go
@@ -4,8 +4,9 @@
package api4
import (
- "github.com/mattermost/mattermost-server/model"
"testing"
+
+ "github.com/mattermost/mattermost-server/model"
)
func TestGetWebrtcToken(t *testing.T) {
diff --git a/api4/websocket.go b/api4/websocket.go
index 6465e49e9..7ea19224b 100644
--- a/api4/websocket.go
+++ b/api4/websocket.go
@@ -13,8 +13,6 @@ import (
)
func (api *API) InitWebSocket() {
- l4g.Debug(utils.T("api.web_socket.init.debug"))
-
api.BaseRoutes.ApiRoot.Handle("/websocket", api.ApiHandlerTrustRequester(connectWebSocket)).Methods("GET")
}
diff --git a/app/apptestlib.go b/app/apptestlib.go
index 618ad809a..912433290 100644
--- a/app/apptestlib.go
+++ b/app/apptestlib.go
@@ -69,14 +69,12 @@ func setupTestHelper(enterprise bool) *TestHelper {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.MaxUsersPerTeam = 50 })
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.RateLimitSettings.Enable = false })
- utils.DisableDebugLogForTest()
prevListenAddress := *th.App.Config().ServiceSettings.ListenAddress
if testStore != nil {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = ":0" })
}
th.App.StartServer()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = prevListenAddress })
- utils.EnableDebugLogForTest()
th.App.Srv.Store.MarkSystemRanUnitTests()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableOpenServer = true })
diff --git a/store/storetest/user_store.go b/store/storetest/user_store.go
index 3b2bf502b..47f04d1bb 100644
--- a/store/storetest/user_store.go
+++ b/store/storetest/user_store.go
@@ -157,11 +157,12 @@ func testUserStoreUpdate(t *testing.T, ss store.Store) {
}
}
+ u3.Email = model.NewId()
if result := <-ss.User().Update(u3, true); result.Err != nil {
t.Fatal("Update should not have failed")
} else {
newUser := result.Data.([2]*model.User)[0]
- if newUser.Email != u3.Email {
+ if newUser.Email == oldEmail {
t.Fatal("Email should have been updated as the update is trusted")
}
}
diff --git a/wsapi/status.go b/wsapi/status.go
index f0b212c73..c3d323053 100644
--- a/wsapi/status.go
+++ b/wsapi/status.go
@@ -7,12 +7,9 @@ import (
l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitStatus() {
- l4g.Debug(utils.T("wsapi.status.init.debug"))
-
api.Router.Handle("get_statuses", api.ApiWebSocketHandler(api.getStatuses))
api.Router.Handle("get_statuses_by_ids", api.ApiWebSocketHandler(api.getStatusesByIds))
}
diff --git a/wsapi/system.go b/wsapi/system.go
index 6959106d6..c3ee8e2a0 100644
--- a/wsapi/system.go
+++ b/wsapi/system.go
@@ -4,14 +4,10 @@
package wsapi
import (
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitSystem() {
- l4g.Debug(utils.T("wsapi.system.init.debug"))
-
api.Router.Handle("ping", api.ApiWebSocketHandler(ping))
}
diff --git a/wsapi/user.go b/wsapi/user.go
index c8236c978..68fe27e0f 100644
--- a/wsapi/user.go
+++ b/wsapi/user.go
@@ -4,14 +4,10 @@
package wsapi
import (
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitUser() {
- l4g.Debug(utils.T("wsapi.user.init.debug"))
-
api.Router.Handle("user_typing", api.ApiWebSocketHandler(api.userTyping))
}
diff --git a/wsapi/webrtc.go b/wsapi/webrtc.go
index 42e749ebb..fbefb1b38 100644
--- a/wsapi/webrtc.go
+++ b/wsapi/webrtc.go
@@ -4,14 +4,10 @@
package wsapi
import (
- l4g "github.com/alecthomas/log4go"
"github.com/mattermost/mattermost-server/model"
- "github.com/mattermost/mattermost-server/utils"
)
func (api *API) InitWebrtc() {
- l4g.Debug(utils.T("wsapi.webtrc.init.debug"))
-
api.Router.Handle("webrtc", api.ApiWebSocketHandler(api.webrtcMessage))
}