mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
Use date attribute for date of birth (#36039)
This commit is contained in:
@@ -131,11 +131,12 @@ class User < ApplicationRecord
|
||||
|
||||
delegate :can?, to: :role
|
||||
|
||||
attr_reader :invite_code, :date_of_birth
|
||||
attr_reader :invite_code
|
||||
attr_writer :current_account
|
||||
|
||||
attribute :external, :boolean, default: false
|
||||
attribute :bypass_registration_checks, :boolean, default: false
|
||||
attribute :date_of_birth, :date
|
||||
|
||||
def self.those_who_can(*any_of_privileges)
|
||||
matching_role_ids = UserRole.that_can(*any_of_privileges).map(&:id)
|
||||
@@ -151,17 +152,6 @@ class User < ApplicationRecord
|
||||
Rails.env.local?
|
||||
end
|
||||
|
||||
def date_of_birth=(hash_or_string)
|
||||
@date_of_birth = begin
|
||||
if hash_or_string.is_a?(Hash)
|
||||
day, month, year = hash_or_string.values_at(1, 2, 3)
|
||||
"#{day}.#{month}.#{year}"
|
||||
else
|
||||
hash_or_string
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def role
|
||||
if role_id.nil?
|
||||
UserRole.everyone
|
||||
|
||||
Reference in New Issue
Block a user