mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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
|
def approve_account_if_needed
|
||||||
if get_existing_user
|
if get_existing_user
|
||||||
invited_user.approve(invite.invited_by_id, false)
|
invited_user.approve(invite.invited_by, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -405,23 +405,17 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Approve this user
|
# Approve this user
|
||||||
def approve(approved_by, send_mail = true)
|
def approve(approver, send_mail = true)
|
||||||
self.approved = 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_at = Time.zone.now
|
||||||
|
self.approved_by = approver
|
||||||
|
|
||||||
if result = save
|
if result = save
|
||||||
send_approval_email if send_mail
|
send_approval_email if send_mail
|
||||||
DiscourseEvent.trigger(:user_approved, self)
|
DiscourseEvent.trigger(:user_approved, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
StaffActionLogger.new(approved_by).log_user_approve(self)
|
StaffActionLogger.new(approver).log_user_approve(self)
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user