Merge commit '2f98134ac69ee840095c9d8389e4b2fff72f20c1' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2025-03-15 17:49:32 +01:00
commit 0efa669fe9
27 files changed
+362 -63

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class DateOfBirthValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add(attribute, :below_limit) if value.present? && value.to_date > min_age.ago
rescue Date::Error
record.errors.add(attribute, :invalid)
end
private
def min_age
Setting.min_age.to_i.years
end
end