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
Этот коммит содержится в:
Felipe Martin
2023-09-11 17:07:29 +02:00
коммит произвёл GitHub
родитель e9cc03c1c8
Коммит f65dad83bb
25 изменённых файлов: 233 добавлений и 194 удалений

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

@@ -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...)
}