mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-10 15:23:50 +01:00
Use distributable?
method in admin/status_policy method (#33477)
This commit is contained in:
parent
efcd4ea5de
commit
dd937e115a
1 changed files with 5 additions and 1 deletions
|
@ -12,7 +12,7 @@ class Admin::StatusPolicy < ApplicationPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
def show?
|
def show?
|
||||||
role.can?(:manage_reports, :manage_users) && (record.public_visibility? || record.unlisted_visibility? || record.reported? || viewable_through_normal_policy?)
|
role.can?(:manage_reports, :manage_users) && eligible_to_show?
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
|
@ -29,6 +29,10 @@ class Admin::StatusPolicy < ApplicationPolicy
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def eligible_to_show?
|
||||||
|
record.distributable? || record.reported? || viewable_through_normal_policy?
|
||||||
|
end
|
||||||
|
|
||||||
def viewable_through_normal_policy?
|
def viewable_through_normal_policy?
|
||||||
StatusPolicy.new(current_account, record, @preloaded_relations).show?
|
StatusPolicy.new(current_account, record, @preloaded_relations).show?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue