From 13c3e59601683d5a5d57f9f2c0238a9ade0a1ad1 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 8 Nov 2023 08:04:52 -0500 Subject: [PATCH] Use helper method to build batched status edits in `admin/statuses/show` (#27739) --- app/controllers/admin/statuses_controller.rb | 5 +++++ app/views/admin/statuses/show.html.haml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/statuses_controller.rb b/app/controllers/admin/statuses_controller.rb index b80cd20f5..5712dea88 100644 --- a/app/controllers/admin/statuses_controller.rb +++ b/app/controllers/admin/statuses_controller.rb @@ -31,6 +31,11 @@ module Admin private + def batched_ordered_status_edits + @status.edits.reorder(nil).includes(:account, status: [:account]).find_each(order: :asc) + end + helper_method :batched_ordered_status_edits + def admin_status_batch_action_params params.require(:admin_status_batch_action).permit(status_ids: []) end diff --git a/app/views/admin/statuses/show.html.haml b/app/views/admin/statuses/show.html.haml index 7067c45dc..0e88624de 100644 --- a/app/views/admin/statuses/show.html.haml +++ b/app/views/admin/statuses/show.html.haml @@ -47,7 +47,7 @@ %h3= t('admin.statuses.history') %ol.history - - @status.edits.reorder(nil).includes(:account, status: [:account]).find_each(order: :asc).with_index do |status_edit, i| + - batched_ordered_status_edits.with_index do |status_edit, i| %li .history__entry %h5