* Add options for changing the order of the modqueue (newest first, oldest first, highest scoring first, lowest scoring first). * Change the default order from oldest posts first to most recently flagged or uploaded posts first. * Add an order:modqueue metatag to order by most recently flagged or uploaded in standard searches.
24 lines
1.3 KiB
Ruby
24 lines
1.3 KiB
Ruby
class ModqueueController < ApplicationController
|
|
respond_to :html, :json, :xml
|
|
before_action :approver_only
|
|
layout "sidebar"
|
|
|
|
def index
|
|
@posts = Post.includes(:appeals, :disapprovals, :uploader, flags: [:creator]).pending_or_flagged.available_for_moderation(search_params[:hidden])
|
|
@posts = @posts.paginated_search(params, order: "modqueue", count_pages: true)
|
|
|
|
@modqueue_posts = @posts.except(:offset, :limit, :order)
|
|
@pending_post_count = @modqueue_posts.pending.count
|
|
@flagged_post_count = @modqueue_posts.flagged.count
|
|
@disapproval_reasons = PostDisapproval.where(post: @modqueue_posts).where.not(reason: "disinterest").group(:reason).order(count: :desc).distinct.count(:post_id)
|
|
@uploaders = @modqueue_posts.group(:uploader).order(count: :desc).limit(20).count
|
|
|
|
@tags = RelatedTagCalculator.frequent_tags_for_post_relation(@modqueue_posts)
|
|
@artist_tags = @tags.select { |tag| tag.category == Tag.categories.artist }.sort_by(&:overlap_count).reverse.take(10)
|
|
@copyright_tags = @tags.select { |tag| tag.category == Tag.categories.copyright }.sort_by(&:overlap_count).reverse.take(10)
|
|
@character_tags = @tags.select { |tag| tag.category == Tag.categories.character }.sort_by(&:overlap_count).reverse.take(10)
|
|
|
|
respond_with(@posts)
|
|
end
|
|
end
|