DEV: Use guards to make `can_delete_reviewable` guardian more readable (#21188)

This commit is contained in:
Isaac Janzen 2023-04-20 11:07:35 -05:00 committed by GitHub
parent ce9cccb2fc
commit 0d2f8c1a45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -232,7 +232,11 @@ class Guardian
end
def can_delete_reviewable_queued_post?(reviewable)
reviewable.present? && authenticated? && (reviewable.created_by_id == @user.id || @user.admin?)
return false if reviewable.blank?
return false if !authenticated?
return true if @user.admin?
reviewable.created_by_id == @user.id
end
def can_see_group?(group)