Merge pull request #3472 from BrokenEagle/fix-status-active-search

Fix status:active so that it doesn't show flagged posts
This commit is contained in:
Albert Yi
2017-12-28 13:47:25 -08:00
committed by GitHub

View File

@@ -137,7 +137,7 @@ class PostQueryBuilder
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")
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] == "all" || q[:status] == "any"
# do nothing
elsif q[:status_neg] == "pending"
@@ -149,7 +149,7 @@ class PostQueryBuilder
elsif q[:status_neg] == "banned"
relation = relation.where("posts.is_banned = FALSE")
elsif q[:status_neg] == "active"
relation = relation.where("posts.is_pending = TRUE OR posts.is_deleted = TRUE OR posts.is_banned = TRUE")
relation = relation.where("posts.is_pending = TRUE OR posts.is_deleted = TRUE OR posts.is_banned = TRUE OR posts.is_flagged = TRUE")
end
if hide_deleted_posts?(q)