mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Only show "Approve" button for the admin user if reviewable
This commit is contained in:
@@ -7,11 +7,21 @@ class AdminUserSerializer < AdminUserListSerializer
|
||||
:can_send_activation_email,
|
||||
:can_activate,
|
||||
:can_deactivate,
|
||||
:can_approve,
|
||||
:ip_address,
|
||||
:registration_ip_address
|
||||
|
||||
has_one :single_sign_on_record, serializer: SingleSignOnRecordSerializer, embed: :objects
|
||||
|
||||
def can_approve
|
||||
reviewable = ReviewableUser.find_by(target: object)
|
||||
reviewable.present? && reviewable.actions_for(scope).has?(:approve)
|
||||
end
|
||||
|
||||
def include_can_approve?
|
||||
SiteSetting.must_approve_users
|
||||
end
|
||||
|
||||
def can_send_activation_email
|
||||
scope.can_send_activation_email?(object)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user