GH-27059: Rewrite error messages about msg length (#29252)

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
Pavel Mokeev
2024-12-10 16:32:13 +03:00
коммит произвёл GitHub
родитель f1d5884532
Коммит 8b86e1276e
4 изменённых файлов: 13 добавлений и 6 удалений

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

@@ -28,7 +28,8 @@ type Draft struct {
func (o *Draft) IsValid(maxDraftSize int) *AppError {
if utf8.RuneCountInString(o.Message) > maxDraftSize {
return NewAppError("Drafts.IsValid", "model.draft.is_valid.msg.app_error", nil, "channelid="+o.ChannelId, http.StatusBadRequest)
return NewAppError("Drafts.IsValid", "model.draft.is_valid.message_length.app_error",
map[string]any{"Length": utf8.RuneCountInString(o.Message), "MaxLength": maxDraftSize}, "channelid="+o.ChannelId, http.StatusBadRequest)
}
return o.BaseIsValid()