Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Fix moderator account leak in status edit history (mastodon#17746)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored Mar 12, 2022
1 parent 75e33fd commit ee8d4dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/admin/status_batch_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def handle_delete!
end

def handle_mark_as_sensitive!
representative_account = Account.representative

# Can't use a transaction here because UpdateStatusService queues
# Sidekiq jobs
statuses.includes(:media_attachments, :preview_cards).find_each do |status|
Expand All @@ -76,7 +78,7 @@ def handle_mark_as_sensitive!
authorize(status, :update?)

if target_account.local?
UpdateStatusService.new.call(status, current_account.id, sensitive: true)
UpdateStatusService.new.call(status, representative_account.id, sensitive: true)
else
status.update(sensitive: true)
end
Expand Down

0 comments on commit ee8d4dd

Please sign in to comment.