Use attribute for User#bypass_registration_checks? (#35580)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2025-07-30 12:55:36 +00:00
1 parent 25add0af31
commit 8896d6c1b1
1 file changed
+2 -5
+2 -5
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