From 7c11fd440b310f9190629ff5bc2027b0bb3f01fd Mon Sep 17 00:00:00 2001 From: Toks Date: Sun, 4 Aug 2013 11:44:17 -0400 Subject: [PATCH] Add pseudo-category search for flags fixes #1915 --- app/models/post_flag.rb | 9 +++++++++ app/views/post_flags/_search.html.erb | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/app/models/post_flag.rb b/app/models/post_flag.rb index 987578510..8d3124c85 100644 --- a/app/models/post_flag.rb +++ b/app/models/post_flag.rb @@ -49,6 +49,15 @@ class PostFlag < ActiveRecord::Base q = q.unresolved end + case params[:category] + when "normal" + q = q.where("reason != ? and reason != ?", "Unapproved in three days", "Artist requested removal") + when "unapproved" + q = q.where("reason = ?", "Unapproved in three days") + when "banned" + q = q.where("reason = ?", "Artist requested removal") + end + q end end diff --git a/app/views/post_flags/_search.html.erb b/app/views/post_flags/_search.html.erb index ae436aec0..c7b4c556d 100644 --- a/app/views/post_flags/_search.html.erb +++ b/app/views/post_flags/_search.html.erb @@ -30,6 +30,15 @@ + + + +
+ <%= select "search", "category", ["normal", "unapproved", "banned"], :selected => params[:search][:category], :include_blank => true %> +
+ + + <%= submit_tag "Search" %>