]> cat aescling's git repositories - mastodon.git/commitdiff
Fix empty batch statuses selection causing a 500 error (#17532)
authorClaire <claire.github-309c@sitedethib.com>
Sat, 12 Feb 2022 18:52:17 +0000 (19:52 +0100)
committerGitHub <noreply@github.com>
Sat, 12 Feb 2022 18:52:17 +0000 (19:52 +0100)
* Fix empty batch statuses selection causing a 500 error

* Simplify current_params

app/controllers/admin/statuses_controller.rb

index 8d039b2810bcf32fabf32fbfa8557cb00842a9f3..817c0caa9000b9c17ca0b18726a7564be035074d 100644 (file)
@@ -29,8 +29,9 @@ module Admin
     end
 
     def after_create_redirect_path
-      if @status_batch_action.report_id.present?
-        admin_report_path(@status_batch_action.report_id)
+      report_id = @status_batch_action&.report_id || params[:report_id]
+      if report_id.present?
+        admin_report_path(report_id)
       else
         admin_account_statuses_path(params[:account_id], current_params)
       end
@@ -48,6 +49,10 @@ module Admin
       params.slice(*Admin::StatusFilter::KEYS).permit(*Admin::StatusFilter::KEYS)
     end
 
+    def current_params
+      params.slice(:media, :page).permit(:media, :page)
+    end
+
     def action_from_button
       if params[:report]
         'report'