From 9c6ef424ef77b0cc48f504a9d2320f6c01b0c0b1 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 17 Feb 2020 02:13:34 -0600 Subject: [PATCH] post_flags/index: remove banned and duplicate search options. Remove options for searching for "Artist requested removal" and "duplicate" flag reasons. These were legacy flag reasons that haven't been used for a long time. --- app/models/post_flag.rb | 17 +---------------- app/views/post_flags/_search.html.erb | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/app/models/post_flag.rb b/app/models/post_flag.rb index 291b4fcee..f7e792be2 100644 --- a/app/models/post_flag.rb +++ b/app/models/post_flag.rb @@ -4,7 +4,6 @@ class PostFlag < ApplicationRecord module Reasons UNAPPROVED = "Unapproved in three days" REJECTED = "Unapproved in three days after returning to moderation queue%" - BANNED = "Artist requested removal" end COOLDOWN_PERIOD = 3.days @@ -27,14 +26,6 @@ class PostFlag < ApplicationRecord scope :old, -> { where("post_flags.created_at <= ?", 3.days.ago) } module SearchMethods - def duplicate - where("to_tsvector('english', post_flags.reason) @@ to_tsquery('dup | duplicate | sample | smaller')") - end - - def not_duplicate - where("to_tsvector('english', post_flags.reason) @@ to_tsquery('!dup & !duplicate & !sample & !smaller')") - end - def search(params) q = super @@ -64,17 +55,13 @@ class PostFlag < ApplicationRecord case params[:category] when "normal" - q = q.where("reason NOT IN (?) AND reason NOT LIKE ?", [Reasons::UNAPPROVED, Reasons::BANNED], Reasons::REJECTED) + q = q.where("reason NOT IN (?) AND reason NOT LIKE ?", [Reasons::UNAPPROVED], Reasons::REJECTED) when "unapproved" q = q.where(reason: Reasons::UNAPPROVED) - when "banned" - q = q.where(reason: Reasons::BANNED) when "rejected" q = q.where("reason LIKE ?", Reasons::REJECTED) when "deleted" q = q.where("reason = ? OR reason LIKE ?", Reasons::UNAPPROVED, Reasons::REJECTED) - when "duplicate" - q = q.duplicate end q.apply_default_order(params) @@ -98,8 +85,6 @@ class PostFlag < ApplicationRecord :unapproved when /#{Reasons::REJECTED.gsub("%", ".*")}/ :rejected - when Reasons::BANNED - :banned else :normal end diff --git a/app/views/post_flags/_search.html.erb b/app/views/post_flags/_search.html.erb index 0a21bdf3e..385349d93 100644 --- a/app/views/post_flags/_search.html.erb +++ b/app/views/post_flags/_search.html.erb @@ -6,6 +6,6 @@ <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %> <% end %> <%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_resolved] %> - <%= f.input :category, label: "Category", collection: ["normal", "unapproved", "rejected", "deleted", "banned", "duplicate"], include_blank: true, selected: params[:search][:category] %> + <%= f.input :category, label: "Category", collection: ["normal", "unapproved", "rejected", "deleted"], include_blank: true, selected: params[:search][:category] %> <%= f.submit "Search" %> <% end %>