<commit_before># frozen_string_literal: true

class FiltersController < ApplicationController
  layout 'admin'

  before_action :authenticate_user!
  before_action :set_filters, only: :index
  before_action :set_filter, only: [:edit, :update, :destroy]
  before_action :set_body_classes

  def index
    @filters = current_account.custom_filters
  end

  def new
    @filter = current_account.custom_filters.build
  end

  def create
    @filter = current_account.custom_filters.build(resource_params)

    if @filter.save
      redirect_to filters_path<commit_msg>Sort filters by “keyword or phrase” in Settings (#15050)<commit_after># frozen_string_literal: true

class FiltersController < ApplicationController
  layout 'admin'

  before_action :authenticate_user!
  before_action :set_filters, only: :index
  before_action :set_filter, only: [:edit, :update, :destroy]
  before_action :set_body_classes

  def index
    @filters = current_account.custom_filters.order(:phrase)
  end

  def new
    @filter = current_account.custom_filters.build
  end

  def create
    @filter = current_account.custom_filters.build(resource_params)

    if @filter.save
      redirect_to filters_path
{'fraction_non_alphanumeric': 0.07491582491582492, 'fraction_numerical': 0.004208754208754209, 'mean_word_length': 4.828431372549019, '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': '3730696', 'n_tokens_mistral': 369, 'n_tokens_neox': 351, 'n_words': 87}