mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: Use guards to make can_delete_reviewable
guardian more readable (#21188)
This commit is contained in:
parent
ce9cccb2fc
commit
0d2f8c1a45
|
@ -232,7 +232,11 @@ class Guardian
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_delete_reviewable_queued_post?(reviewable)
|
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
|
end
|
||||||
|
|
||||||
def can_see_group?(group)
|
def can_see_group?(group)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user