FIX: do not show "Send Activation Email" button if `must_approve_users` setting is enabled
https://meta.discourse.org/t/error-when-pressing-send-activitation-email-when-must-approve-users-setting-is-enabled/65408
This commit is contained in:
parent
a7a8ccb100
commit
c243861b17
|
@ -8,8 +8,7 @@ class AdminUserSerializer < AdminUserListSerializer
|
||||||
:can_activate,
|
:can_activate,
|
||||||
:can_deactivate,
|
:can_deactivate,
|
||||||
:ip_address,
|
:ip_address,
|
||||||
:registration_ip_address,
|
:registration_ip_address
|
||||||
:can_send_activation_email
|
|
||||||
|
|
||||||
has_one :single_sign_on_record, serializer: SingleSignOnRecordSerializer, embed: :objects
|
has_one :single_sign_on_record, serializer: SingleSignOnRecordSerializer, embed: :objects
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,12 @@ class Guardian
|
||||||
end
|
end
|
||||||
alias :can_move_posts? :can_moderate?
|
alias :can_move_posts? :can_moderate?
|
||||||
alias :can_see_flags? :can_moderate?
|
alias :can_see_flags? :can_moderate?
|
||||||
alias :can_send_activation_email? :can_moderate?
|
|
||||||
alias :can_close? :can_moderate?
|
alias :can_close? :can_moderate?
|
||||||
|
|
||||||
|
def can_send_activation_email?(user)
|
||||||
|
user && is_staff? && !SiteSetting.must_approve_users?
|
||||||
|
end
|
||||||
|
|
||||||
def can_grant_badges?(_user)
|
def can_grant_badges?(_user)
|
||||||
SiteSetting.enable_badges && is_staff?
|
SiteSetting.enable_badges && is_staff?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue