mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: less crazy error when post exceeds max length.
This commit is contained in:
parent
c6ece058f0
commit
5b310c21b4
2 changed files with 3 additions and 1 deletions
|
@ -36,6 +36,8 @@ en:
|
|||
is_reserved: "is reserved"
|
||||
|
||||
errors:
|
||||
messages:
|
||||
too_long_validation: "is limited to %{max} characters; you entered %{length}."
|
||||
embed:
|
||||
load_from_remote: "There was an error loading that post."
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class Validators::StrippedLengthValidator < ActiveModel::EachValidator
|
|||
stripped_length = value.strip.length
|
||||
record.errors.add attribute, (I18n.t('errors.messages.too_short', count: range.begin)) unless
|
||||
stripped_length >= range.begin
|
||||
record.errors.add attribute, (I18n.t('errors.messages.too_long', count: range.end)) unless
|
||||
record.errors.add attribute, (I18n.t('errors.messages.too_long_validation', max: range.end, length: stripped_length)) unless
|
||||
stripped_length <= range.end
|
||||
else
|
||||
record.errors.add attribute, (I18n.t('errors.messages.blank'))
|
||||
|
|
Loading…
Reference in a new issue