Use attribute for User#bypass_registration_checks? (#35580)

This commit is contained in:
Matt Jankowski 2025-07-30 08:55:36 -04:00 committed by GitHub
parent 25add0af31
commit 8896d6c1b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,9 +132,10 @@ class User < ApplicationRecord
delegate :can?, to: :role
attr_reader :invite_code, :date_of_birth
attr_writer :bypass_registration_checks, :current_account
attr_writer :current_account
attribute :external, :boolean, default: false
attribute :bypass_registration_checks, :boolean, default: false
def self.those_who_can(*any_of_privileges)
matching_role_ids = UserRole.that_can(*any_of_privileges).map(&:id)
@ -477,10 +478,6 @@ class User < ApplicationRecord
Setting.registrations_mode == 'open'
end
def bypass_registration_checks?
@bypass_registration_checks
end
def sanitize_role
self.role = nil if role.present? && role.everyone?
end