FIX: Only show "Approve" button for the admin user if reviewable
This commit is contained in:
parent
73663c2fdb
commit
692e09d813
|
@ -18,7 +18,6 @@ class AdminUserListSerializer < BasicUserSerializer
|
|||
:username,
|
||||
:title,
|
||||
:avatar_template,
|
||||
:can_approve,
|
||||
:approved,
|
||||
:suspended_at,
|
||||
:suspended_till,
|
||||
|
@ -106,14 +105,6 @@ class AdminUserListSerializer < BasicUserSerializer
|
|||
Time.now - object.created_at
|
||||
end
|
||||
|
||||
def can_approve
|
||||
scope.can_approve?(object)
|
||||
end
|
||||
|
||||
def include_can_approve?
|
||||
SiteSetting.must_approve_users
|
||||
end
|
||||
|
||||
def include_approved?
|
||||
SiteSetting.must_approve_users
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue