Extract component to render the date of birth

We reduce code duplication thanks to that, and make it easier
to change this field.

Note that there was one place where the "16.years" value was
hardcoded. We're moving the test for this case to the
component and changing it so the test doesn't use the default
age.

We're also removing the redundant helper method that had the
same code as a method in the User class which is called
everywhere else.
This commit is contained in:
Javi Martín
2024-10-12 15:56:47 +02:00
parent 6f81215425
commit 6af8ddd324
10 changed files with 58 additions and 35 deletions

View File

@@ -5,10 +5,6 @@ module VerificationHelper
[t("verification.residence.new.document_type.residence_card"), 3]]
end
def minimum_required_age
(Setting["min_age_to_participate"] || 16).to_i
end
def mask_phone(number)
match = number.match(/\d{3}$/)
"******#{match}"