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 удалений

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

@@ -437,7 +437,8 @@ func (o *Post) IsValid(maxPostSize int) *AppError {
}
if utf8.RuneCountInString(o.Message) > maxPostSize {
return NewAppError("Post.IsValid", "model.post.is_valid.msg.app_error", nil, "id="+o.Id, http.StatusBadRequest)
return NewAppError("Post.IsValid", "model.post.is_valid.message_length.app_error",
map[string]any{"Length": utf8.RuneCountInString(o.Message), "MaxLength": maxPostSize}, "id="+o.Id, http.StatusBadRequest)
}
if utf8.RuneCountInString(o.Hashtags) > PostHashtagsMaxRunes {