Fix Style/GuardClause in User#wrap_email_confirmation (#35524)
This commit is contained in:
@@ -466,9 +466,11 @@ class User < ApplicationRecord
|
|||||||
|
|
||||||
yield
|
yield
|
||||||
|
|
||||||
if new_user
|
after_confirmation_tasks if new_user
|
||||||
# Avoid extremely unlikely race condition when approving and confirming
|
end
|
||||||
# the user at the same time
|
|
||||||
|
def after_confirmation_tasks
|
||||||
|
# Handle condition when approving and confirming a user at the same time
|
||||||
reload unless approved?
|
reload unless approved?
|
||||||
|
|
||||||
if approved?
|
if approved?
|
||||||
@@ -477,7 +479,6 @@ class User < ApplicationRecord
|
|||||||
notify_staff_about_pending_account!
|
notify_staff_about_pending_account!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def sign_up_from_ip_requires_approval?
|
def sign_up_from_ip_requires_approval?
|
||||||
sign_up_ip.present? && IpBlock.severity_sign_up_requires_approval.containing(sign_up_ip.to_s).exists?
|
sign_up_ip.present? && IpBlock.severity_sign_up_requires_approval.containing(sign_up_ip.to_s).exists?
|
||||||
|
|||||||
Reference in New Issue
Block a user