Change media attachments in moderated posts to not be accessible (#34872)
This commit is contained in:
13
app/policies/media_attachment_policy.rb
Normal file
13
app/policies/media_attachment_policy.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MediaAttachmentPolicy < ApplicationPolicy
|
||||
def download?
|
||||
(record.discarded? && role.can?(:manage_reports)) || show_status?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def show_status?
|
||||
record.status && StatusPolicy.new(current_account, record.status).show?
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user