Fix #4688: Malformed SQL when searching -status:any.

Negating `Post.all` produced the invalid SQL fragment `WHERE NOT ()`.
Use `Post.where("TRUE")` instead to produce `WHERE NOT (TRUE)`.
This commit is contained in:
evazion
2021-02-03 21:15:58 -06:00
parent e90f792e20
commit 19974d3ab1
2 changed files with 8 additions and 1 deletions

View File

@@ -290,7 +290,7 @@ class PostQueryBuilder
when "unmoderated"
Post.in_modqueue.available_for_moderation(current_user, hidden: false)
when "all", "any"
Post.all
Post.where("TRUE")
else
Post.none
end