about summary refs log tree commit diff
path: root/app/models/admin
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-05-26 22:08:02 +0200
committerGitHub <noreply@github.com>2022-05-26 22:08:02 +0200
commitc4d2c39a75eccdbc60c3540c259e1e7ea5881ac6 (patch)
treed65b111eeeb019673a4993f7888d2b8eebb3e11a /app/models/admin
parent1ff4877945e18820f3e518a1cfbac243da65e1a5 (diff)
Fix being able to report otherwise inaccessible statuses (#18528)
Diffstat (limited to 'app/models/admin')
-rw-r--r--app/models/admin/status_batch_action.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/admin/status_batch_action.rb b/app/models/admin/status_batch_action.rb
index 631af183c..7bf6fa6da 100644
--- a/app/models/admin/status_batch_action.rb
+++ b/app/models/admin/status_batch_action.rb
@@ -103,7 +103,7 @@ class Admin::StatusBatchAction
 
   def handle_report!
     @report = Report.new(report_params) unless with_report?
-    @report.status_ids = (@report.status_ids + status_ids.map(&:to_i)).uniq
+    @report.status_ids = (@report.status_ids + allowed_status_ids).uniq
     @report.save!
 
     @report_id = @report.id
@@ -135,4 +135,8 @@ class Admin::StatusBatchAction
   def report_params
     { account: current_account, target_account: target_account }
   end
+
+  def allowed_status_ids
+    AccountStatusesFilter.new(@report.target_account, current_account).results.with_discarded.where(id: status_ids).pluck(:id)
+  end
 end