mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 17:17:32 +00:00
Fix poll validation issues (#10186)
- Fix missing interpolation argument in PollValidator - Fix PollValidator rejecting exact allowed min/max durations
This commit is contained in:
parent
d97cbb0da6
commit
5996be994d
|
@ -13,7 +13,7 @@ class PollValidator < ActiveModel::Validator
|
|||
poll.errors.add(:options, I18n.t('polls.errors.too_many_options', max: MAX_OPTIONS)) if poll.options.size > MAX_OPTIONS
|
||||
poll.errors.add(:options, I18n.t('polls.errors.over_character_limit', max: MAX_OPTION_CHARS)) if poll.options.any? { |option| option.mb_chars.grapheme_length > MAX_OPTION_CHARS }
|
||||
poll.errors.add(:options, I18n.t('polls.errors.duplicate_options')) unless poll.options.uniq.size == poll.options.size
|
||||
poll.errors.add(:expires_at, I18n.t('polls.errors.duration_too_long')) if poll.expires_at.nil? || poll.expires_at - current_time >= MAX_EXPIRATION
|
||||
poll.errors.add(:expires_at, I18n.t('polls.errors.duration_too_short')) if poll.expires_at.present? && poll.expires_at - current_time <= MIN_EXPIRATION
|
||||
poll.errors.add(:expires_at, I18n.t('polls.errors.duration_too_long')) if poll.expires_at.nil? || poll.expires_at - current_time > MAX_EXPIRATION
|
||||
poll.errors.add(:expires_at, I18n.t('polls.errors.duration_too_short')) if poll.expires_at.present? && poll.expires_at - current_time < MIN_EXPIRATION
|
||||
end
|
||||
end
|
||||
|
|
|
@ -741,9 +741,9 @@ co:
|
|||
duration_too_long: hè troppu luntanu indè u futuru
|
||||
duration_too_short: hè troppu prossimu
|
||||
expired: U scandagliu hè digià finitu
|
||||
over_character_limit: ùn ponu micca esse più longhi chè %{MAX} caratteri
|
||||
over_character_limit: ùn ponu micca esse più longhi chè %{max} caratteri
|
||||
too_few_options: deve avè più d'un'uzzione
|
||||
too_many_options: ùn pò micca avè più di %{MAX} uzzione
|
||||
too_many_options: ùn pò micca avè più di %{max} uzzione
|
||||
preferences:
|
||||
languages: Lingue
|
||||
other: Altre
|
||||
|
|
|
@ -752,9 +752,9 @@ cs:
|
|||
duration_too_long: je příliš daleko v budoucnosti
|
||||
duration_too_short: je příliš brzy
|
||||
expired: Anketa již skončila
|
||||
over_character_limit: nesmí být každá delší než %{MAX} znaků
|
||||
over_character_limit: nesmí být každá delší než %{max} znaků
|
||||
too_few_options: musí mít více než jednu položku
|
||||
too_many_options: nesmí obsahovat více než %{MAX} položky
|
||||
too_many_options: nesmí obsahovat více než %{max} položky
|
||||
preferences:
|
||||
languages: Jazyky
|
||||
other: Ostatní
|
||||
|
|
|
@ -740,9 +740,9 @@ el:
|
|||
duration_too_long: είναι πολύ μακριά στο μέλλον
|
||||
duration_too_short: είναι πολύ σύντομα
|
||||
expired: Η ψηφοφορία έχει ήδη λήξει
|
||||
over_character_limit: δε μπορεί να υπερβαίνει τους %{MAX} χαρακτήρες έκαστη
|
||||
over_character_limit: δε μπορεί να υπερβαίνει τους %{max} χαρακτήρες έκαστη
|
||||
too_few_options: πρέπει να έχει περισσότερες από μια επιλογές
|
||||
too_many_options: δεν μπορεί να έχει περισσότερες από %{MAX} επιλογές
|
||||
too_many_options: δεν μπορεί να έχει περισσότερες από %{max} επιλογές
|
||||
preferences:
|
||||
languages: Γλώσσες
|
||||
other: Άλλο
|
||||
|
|
|
@ -741,9 +741,9 @@ en:
|
|||
duration_too_long: is too far into the future
|
||||
duration_too_short: is too soon
|
||||
expired: The poll has already ended
|
||||
over_character_limit: cannot be longer than %{MAX} characters each
|
||||
over_character_limit: cannot be longer than %{max} characters each
|
||||
too_few_options: must have more than one item
|
||||
too_many_options: can't contain more than %{MAX} items
|
||||
too_many_options: can't contain more than %{max} items
|
||||
preferences:
|
||||
languages: Languages
|
||||
other: Other
|
||||
|
|
|
@ -741,9 +741,9 @@ fa:
|
|||
duration_too_long: در آیندهٔ خیلی دور است
|
||||
duration_too_short: در آیندهٔ خیلی نزدیک است
|
||||
expired: این نظرسنجی به پایان رسیده است
|
||||
over_character_limit: هر کدام نمیتواند از %{MAX} نویسه طولانیتر باشد
|
||||
over_character_limit: هر کدام نمیتواند از %{max} نویسه طولانیتر باشد
|
||||
too_few_options: حتماً باید بیش از یک گزینه داشته باشد
|
||||
too_many_options: نمیتواند بیشتر از %{MAX} گزینه داشته باشد
|
||||
too_many_options: نمیتواند بیشتر از %{max} گزینه داشته باشد
|
||||
preferences:
|
||||
languages: تنظیمات زبان
|
||||
other: سایر تنظیمات
|
||||
|
|
|
@ -741,9 +741,9 @@ fr:
|
|||
duration_too_long: est trop loin dans le futur
|
||||
duration_too_short: est trop tôt
|
||||
expired: Ce sondage est déjà terminé
|
||||
over_character_limit: ne peuvent être plus long que %{MAX} caractères chacun
|
||||
over_character_limit: ne peuvent être plus long que %{max} caractères chacun
|
||||
too_few_options: doit avoir plus qu'une proposition
|
||||
too_many_options: ne peut contenir plus que %{MAX} propositions
|
||||
too_many_options: ne peut contenir plus que %{max} propositions
|
||||
preferences:
|
||||
languages: Langues
|
||||
other: Autre
|
||||
|
|
|
@ -741,9 +741,9 @@ gl:
|
|||
duration_too_long: está moi lonxe no futuro
|
||||
duration_too_short: é demasiado cedo
|
||||
expired: A sondaxe rematou
|
||||
over_character_limit: non poden ter máis de %{MAX} caracteres cada unha
|
||||
over_character_limit: non poden ter máis de %{max} caracteres cada unha
|
||||
too_few_options: debe ter máis de unha opción
|
||||
too_many_options: non pode haber máis de %{MAX} opcións
|
||||
too_many_options: non pode haber máis de %{max} opcións
|
||||
preferences:
|
||||
languages: Idiomas
|
||||
other: Outro
|
||||
|
|
|
@ -743,9 +743,9 @@ ko:
|
|||
duration_too_long: 너무 먼 미래입니다
|
||||
duration_too_short: 너무 가깝습니다
|
||||
expired: 투표가 이미 끝났습니다
|
||||
over_character_limit: 각각 %{MAX} 글자를 넘을 수 없습니다
|
||||
over_character_limit: 각각 %{max} 글자를 넘을 수 없습니다
|
||||
too_few_options: 한가지 이상의 항목을 포함해야 합니다
|
||||
too_many_options: 항목은 %{MAX}개를 넘을 수 없습니다
|
||||
too_many_options: 항목은 %{max}개를 넘을 수 없습니다
|
||||
preferences:
|
||||
languages: 언어
|
||||
other: 기타
|
||||
|
|
|
@ -752,9 +752,9 @@ sk:
|
|||
duration_too_long: je príliš ďaleko do budúcnosti
|
||||
duration_too_short: je príliš skoro
|
||||
expired: Anketa už skončila
|
||||
over_character_limit: každá nemôže byť dlhšia ako %{MAX} znakov
|
||||
over_character_limit: každá nemôže byť dlhšia ako %{max} znakov
|
||||
too_few_options: musí mať viac ako jednu položku
|
||||
too_many_options: nemôže zahŕňať viac ako %{MAX} položiek
|
||||
too_many_options: nemôže zahŕňať viac ako %{max} položiek
|
||||
preferences:
|
||||
languages: Jazyky
|
||||
other: Ostatné
|
||||
|
|
Loading…
Reference in a new issue