MM-45193 Use context for channel logging (#20575)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5f4da3f308
Коммит
6dc897b04f
@@ -168,6 +168,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
c.AppContext.SetUserAgent(r.UserAgent())
|
||||
c.AppContext.SetAcceptLanguage(r.Header.Get("Accept-Language"))
|
||||
c.AppContext.SetPath(r.URL.Path)
|
||||
c.AppContext.SetContext(context.Background())
|
||||
c.Params = ParamsFromRequest(r)
|
||||
c.Logger = c.App.Log()
|
||||
|
||||
@@ -305,6 +306,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
mlog.String("user_id", c.AppContext.Session().UserId),
|
||||
mlog.String("method", r.Method),
|
||||
)
|
||||
c.AppContext.SetLogger(c.Logger)
|
||||
|
||||
if c.Err == nil && h.RequireSession {
|
||||
c.SessionRequired()
|
||||
|
||||
@@ -152,7 +152,7 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.LogErrorByCode(err)
|
||||
break
|
||||
}
|
||||
c.App.AddDirectChannels(teamId, user)
|
||||
c.App.AddDirectChannels(c.AppContext, teamId, user)
|
||||
}
|
||||
case model.OAuthActionEmailToSSO:
|
||||
if err = c.App.RevokeAllSessions(user.Id); err != nil {
|
||||
|
||||
@@ -119,7 +119,6 @@ func setupTestHelper(tb testing.TB, includeCacheLayer bool) *TestHelper {
|
||||
*cfg.PasswordSettings.Number = false
|
||||
})
|
||||
|
||||
ctx := &request.Context{}
|
||||
a := app.New(app.ServerConnector(s.Channels()))
|
||||
|
||||
web := New(s)
|
||||
@@ -134,12 +133,13 @@ func setupTestHelper(tb testing.TB, includeCacheLayer bool) *TestHelper {
|
||||
|
||||
th := &TestHelper{
|
||||
App: a,
|
||||
Context: ctx,
|
||||
Context: request.EmptyContext(testLogger),
|
||||
Server: s,
|
||||
Web: web,
|
||||
IncludeCacheLayer: includeCacheLayer,
|
||||
TestLogger: testLogger,
|
||||
}
|
||||
th.Context.SetLogger(testLogger)
|
||||
|
||||
return th
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user