FIX: invite approval `StaffActionLogger` bug (#7151)
* FIX: invite approval `StaffActionLogger` bug
This commit is contained in:
parent
6d0528687d
commit
4a00772c19
|
@ -133,7 +133,7 @@ InviteRedeemer = Struct.new(:invite, :username, :name, :password, :user_custom_f
|
|||
|
||||
def approve_account_if_needed
|
||||
if get_existing_user
|
||||
invited_user.approve(invite.invited_by_id, false)
|
||||
invited_user.approve(invite.invited_by, false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -405,23 +405,17 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
# Approve this user
|
||||
def approve(approved_by, send_mail = true)
|
||||
def approve(approver, send_mail = true)
|
||||
self.approved = true
|
||||
|
||||
if approved_by.is_a?(Integer)
|
||||
self.approved_by_id = approved_by
|
||||
else
|
||||
self.approved_by = approved_by
|
||||
end
|
||||
|
||||
self.approved_at = Time.zone.now
|
||||
self.approved_by = approver
|
||||
|
||||
if result = save
|
||||
send_approval_email if send_mail
|
||||
DiscourseEvent.trigger(:user_approved, self)
|
||||
end
|
||||
|
||||
StaffActionLogger.new(approved_by).log_user_approve(self)
|
||||
StaffActionLogger.new(approver).log_user_approve(self)
|
||||
|
||||
result
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue