mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 06:18:14 +08:00
FIX: Hide delete button to invite as user are unable to delete anyway (#21884)
Moderators are not allowed to delete invites that don't belong to them
This commit is contained in:
@ -7,6 +7,7 @@ class InviteSerializer < ApplicationSerializer
|
||||
:email,
|
||||
:domain,
|
||||
:emailed,
|
||||
:can_delete_invite,
|
||||
:max_redemptions_allowed,
|
||||
:redemption_count,
|
||||
:custom_message,
|
||||
@ -30,6 +31,10 @@ class InviteSerializer < ApplicationSerializer
|
||||
object.emailed_status != Invite.emailed_status_types[:not_required]
|
||||
end
|
||||
|
||||
def can_delete_invite
|
||||
scope.is_admin? || object.invited_by_id == scope.current_user.id
|
||||
end
|
||||
|
||||
def include_custom_message?
|
||||
email.present?
|
||||
end
|
||||
|
Reference in New Issue
Block a user