0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

FIX: text length validation bug

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-07-07 11:50:56 +05:30
Ursprung 9293aaeabc
Commit c9f90fb8ce

Datei anzeigen

@ -32,11 +32,11 @@ class ::CustomWizard::UpdateValidator
@updater.errors.add(field_id, I18n.t('wizard.field.required', label: label))
end
if min_length && value.is_a?(String) && value.strip.length < min_length.to_i
if min_length.present? && value.is_a?(String) && value.strip.length < min_length.to_i
@updater.errors.add(field_id, I18n.t('wizard.field.too_short', label: label, min: min_length.to_i))
end
if max_length && value.is_a?(String) && value.strip.length > max_length.to_i
if max_length.present? && value.is_a?(String) && value.strip.length > max_length.to_i
@updater.errors.add(field_id, I18n.t('wizard.field.too_long', label: label, max: max_length.to_i))
end