modqueue: fix incorrect page counts when filtering by tag.

Fix a bug where the modqueue didn't show the correct page count when
filtering by tag. Before we showed the total number of posts in the
modqueue, instead of the actual number of posts for your search. This
was for speed reasons, but with recent fixes it should be less of a
problem to count the actual number of pages for the search.
This commit is contained in:
evazion
2022-09-28 00:32:29 -05:00
parent 4c03ea5be3
commit 266fed1b99

View File

@@ -8,7 +8,7 @@ class ModqueueController < ApplicationController
authorize :modqueue
@posts = Post.includes(:appeals, :disapprovals, :uploader, :media_asset, flags: [:creator]).available_for_moderation(CurrentUser.user, hidden: search_params[:hidden])
@modqueue_posts = @posts.reselect(nil).reorder(nil).offset(nil).limit(nil)
@posts = @posts.paginated_search(params, count_pages: true, count: @modqueue_posts.to_a.size, defaults: { order: "modqueue" })
@posts = @posts.paginated_search(params, count_pages: true, defaults: { order: "modqueue" })
@pending_post_count = @modqueue_posts.select(&:is_pending?).count
@flagged_post_count = @modqueue_posts.select(&:is_flagged?).count