about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-03-06 04:54:11 +0100
committerGitHub <noreply@github.com>2019-03-06 04:54:11 +0100
commit5996be994d7a27ffb5075d663acf02dddc32ea7e (patch)
tree6223a11e993f313f9d28452826d5c87bfb05f13f
parentd97cbb0da60f32c9e7e60445af329173b0df1aa7 (diff)
Fix poll validation issues (#10186)
- Fix missing interpolation argument in PollValidator
- Fix PollValidator rejecting exact allowed min/max durations
-rw-r--r--app/validators/poll_validator.rb4
-rw-r--r--config/locales/co.yml4
-rw-r--r--config/locales/cs.yml4
-rw-r--r--config/locales/el.yml4
-rw-r--r--config/locales/en.yml4
-rw-r--r--config/locales/fa.yml4
-rw-r--r--config/locales/fr.yml4
-rw-r--r--config/locales/gl.yml4
-rw-r--r--config/locales/ko.yml4
-rw-r--r--config/locales/sk.yml4
10 files changed, 20 insertions, 20 deletions
diff --git a/app/validators/poll_validator.rb b/app/validators/poll_validator.rb
index d4ae4c16a..fd497c8d0 100644
--- a/app/validators/poll_validator.rb
+++ b/app/validators/poll_validator.rb
@@ -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
diff --git a/config/locales/co.yml b/config/locales/co.yml
index d30fc9e96..8fcb27598 100644
--- a/config/locales/co.yml
+++ b/config/locales/co.yml
@@ -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
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index e751b5266..fe83bd57a 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -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í
diff --git a/config/locales/el.yml b/config/locales/el.yml
index ca821c4fc..35da50af7 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -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: Άλλο
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2d23b1eb6..f714884f9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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
diff --git a/config/locales/fa.yml b/config/locales/fa.yml
index 4cf8f415c..4214e793c 100644
--- a/config/locales/fa.yml
+++ b/config/locales/fa.yml
@@ -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: سایر تنظیمات
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index c84dc8063..b9d813e9e 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -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
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 3c58e04f5..2435137f9 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -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
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 6fa18b12a..fe347a703 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -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: 기타
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index b29a7a934..0800b8f8c 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -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é