<commit_before>class Moderation::ProposalsController < Moderation::BaseController

  has_filters %w{pending_flag_review all with_ignored_flag}, only: :index
  has_orders %w{created_at flags}, only: :index

  before_filter :load_proposals, only: [:index, :moderate]

  load_and_authorize_resource

  def index
    @proposals = @proposals.send(@current_filter)
                           .send("sort_by_#{@current_order}")
                           .page(params[:page])
                           .per(50)
  end

  def hide
    @proposal.hide
  end

  def moderate
    @proposals = @proposals.where(id: params[:proposal_ids])

    if params[:hide_proposals].present?
      @proposals.accessible_by(current_ability, :hide).each(&:hide)

    elsif params[:ignore_flags].present?
      @proposals.accessible_by(current_ability, :ignore_flag).each(&:ignore_flag)

    elsif params[:block_authors].present?
      author_ids = @proposals.pluck(:author_id).uniq
      User.where(id: author_ids).accessible_by(current_ability, :block).each(&:block)
    end<commit_msg>changes default order in moderation/proposals<commit_after>class Moderation::ProposalsController < Moderation::BaseController

  has_filters %w{pending_flag_review all with_ignored_flag}, only: :index
  has_orders %w{flags created_at}, only: :index

  before_filter :load_proposals, only: [:index, :moderate]

  load_and_authorize_resource

  def index
    @proposals = @proposals.send(@current_filter)
                           .send("sort_by_#{@current_order}")
                           .page(params[:page])
                           .per(50)
  end

  def hide
    @proposal.hide
  end

  def moderate
    @proposals = @proposals.where(id: params[:proposal_ids])

    if params[:hide_proposals].present?
      @proposals.accessible_by(current_ability, :hide).each(&:hide)

    elsif params[:ignore_flags].present?
      @proposals.accessible_by(current_ability, :ignore_flag).each(&:ignore_flag)

    elsif params[:block_authors].present?
      author_ids = @proposals.pluck(:author_id).uniq
      User.where(id: author_ids).accessible_by(current_ability, :block).each(&:block)
    end
{'fraction_non_alphanumeric': 0.11488372093023255, 'fraction_numerical': 0.0018604651162790699, 'mean_word_length': 3.537974683544304, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3742992', 'n_tokens_mistral': 712, 'n_tokens_neox': 678, 'n_words': 109}