search: add status:modqueue, status:unmoderated metatags.

* status:modqueue = ~status:pending ~status:flagged
* status:unmoderated = status:modqueue -user:self -approver:self -disapproval:any
This commit is contained in:
evazion
2018-08-23 14:45:33 -05:00
parent 89c4fe150a
commit 4f02c7f70a
4 changed files with 23 additions and 2 deletions

View File

@@ -131,18 +131,24 @@ class PostQueryBuilder
relation = relation.where("posts.is_pending = TRUE")
elsif q[:status] == "flagged"
relation = relation.where("posts.is_flagged = TRUE")
elsif q[:status] == "modqueue"
relation = relation.where("posts.is_pending = TRUE OR posts.is_flagged = TRUE")
elsif q[:status] == "deleted"
relation = relation.where("posts.is_deleted = TRUE")
elsif q[:status] == "banned"
relation = relation.where("posts.is_banned = TRUE")
elsif q[:status] == "active"
relation = relation.where("posts.is_pending = FALSE AND posts.is_deleted = FALSE AND posts.is_banned = FALSE AND posts.is_flagged = FALSE")
elsif q[:status] == "unmoderated"
relation = relation.merge(Post.pending_or_flagged.available_for_moderation)
elsif q[:status] == "all" || q[:status] == "any"
# do nothing
elsif q[:status_neg] == "pending"
relation = relation.where("posts.is_pending = FALSE")
elsif q[:status_neg] == "flagged"
relation = relation.where("posts.is_flagged = FALSE")
elsif q[:status_neg] == "modqueue"
relation = relation.where("posts.is_pending = FALSE AND posts.is_flagged = FALSE")
elsif q[:status_neg] == "deleted"
relation = relation.where("posts.is_deleted = FALSE")
elsif q[:status_neg] == "banned"