Migrate emojiStore to use request.CTX instead of context.Context (#24514)
* migrate emojistore to request.ctx * use mlog.CreateConsoleTestLogger * Add comment to WithMaster and RequestContextWithMaster
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e9cc03c1c8
Коммит
f65dad83bb
@@ -5,6 +5,7 @@ package request
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
||||
@@ -46,6 +47,13 @@ func EmptyContext(logger mlog.LoggerIFace) *Context {
|
||||
}
|
||||
}
|
||||
|
||||
// TestContext creates an empty context with a new logger to use in testing where a test helper is
|
||||
// not required.
|
||||
func TestContext(t *testing.T) *Context {
|
||||
logger := mlog.CreateConsoleTestLogger(t)
|
||||
return EmptyContext(logger)
|
||||
}
|
||||
|
||||
func (c *Context) T(translationID string, args ...any) string {
|
||||
return c.t(translationID, args...)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user