Files
danbooru/app/controllers/moderator/post/queues_controller.rb
evazion 980103e443 modqueue: optimize sql queries.
* Include appeals and flags.
* Avoid an existence query for pools.
* Avoid a query checking if the user has previously approved the post.
  This is a rare condition and it will be prevented anyway if the user
  tries to reapprove the post.
2020-02-29 17:46:57 -06:00

25 lines
737 B
Ruby

module Moderator
module Post
class QueuesController < ApplicationController
respond_to :html, :json
before_action :approver_only
skip_before_action :api_check
def show
if search_params[:per_page]
cookies.permanent["mq_per_page"] = search_params[:per_page]
end
@posts = ::Post.includes(:appeals, :disapprovals, :uploader, flags: [:creator]).reorder(id: :asc).pending_or_flagged.available_for_moderation(search_params[:hidden]).tag_match(search_params[:tags]).paginate(params[:page], :limit => per_page)
respond_with(@posts)
end
protected
def per_page
cookies["mq_per_page"] || search_params[:per_page] || 25
end
end
end
end