Skip to content

Commit

Permalink
Fix using wrong policy on status-related actions in admin UI (mastodo…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and Nonexistent committed Nov 1, 2022
1 parent 62dba64 commit 6c8905c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/models/admin/status_batch_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def process_action!
end

def handle_delete!
statuses.each { |status| authorize(status, :destroy?) }
statuses.each { |status| authorize([:admin, status], :destroy?) }

ApplicationRecord.transaction do
statuses.each do |status|
Expand Down Expand Up @@ -75,7 +75,7 @@ def handle_mark_as_sensitive!
statuses.includes(:media_attachments, :preview_cards).find_each do |status|
next unless status.with_media? || status.with_preview_card?

authorize(status, :update?)
authorize([:admin, status], :update?)

if target_account.local?
UpdateStatusService.new.call(status, representative_account.id, sensitive: true)
Expand Down
4 changes: 2 additions & 2 deletions app/models/trends/status_batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def status_accounts
end

def approve!
statuses.each { |status| authorize(status, :review?) }
statuses.each { |status| authorize([:admin, status], :review?) }
statuses.update_all(trendable: true)
end

Expand All @@ -45,7 +45,7 @@ def approve_accounts!
end

def reject!
statuses.each { |status| authorize(status, :review?) }
statuses.each { |status| authorize([:admin, status], :review?) }
statuses.update_all(trendable: false)
end

Expand Down

0 comments on commit 6c8905c

Please sign in to comment.