From dd937e115a42b1029038578217bb105c56a0f4a4 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 7 Jan 2025 02:47:58 -0500 Subject: [PATCH] Use `distributable?` method in admin/status_policy method (#33477) --- app/policies/admin/status_policy.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/policies/admin/status_policy.rb b/app/policies/admin/status_policy.rb index e9379c25ec..c4ba5c2606 100644 --- a/app/policies/admin/status_policy.rb +++ b/app/policies/admin/status_policy.rb @@ -12,7 +12,7 @@ class Admin::StatusPolicy < ApplicationPolicy end 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 def destroy? @@ -29,6 +29,10 @@ class Admin::StatusPolicy < ApplicationPolicy private + def eligible_to_show? + record.distributable? || record.reported? || viewable_through_normal_policy? + end + def viewable_through_normal_policy? StatusPolicy.new(current_account, record, @preloaded_relations).show? end