Fix #5132: Modqueue displays active posts when excluding any search term

Fix a bug where searching for a negated tag inside the modqueue would show
active posts.

The bug was that in a search like this:

    Post.in_modqueue.user_tag_match("-solo")

The `in_modqueue` condition would get sucked inside the tag search and negated
when we tried to apply the negation operator to the "solo" tag. So effectively
the `in_modqueue` condition would get negated and we would end up searching for
everything not in the modqueue.
This commit is contained in:
evazion
2022-09-28 00:13:39 -05:00
parent 59f166a637
commit 4c03ea5be3
4 changed files with 40 additions and 5 deletions

View File

@@ -255,8 +255,7 @@ class PostQueryBuilder
end
end
def posts(post_query, includes: nil)
relation = Post.all
def posts(post_query, relation = Post.unscoped, includes: nil)
relation = add_joins(post_query, relation)
relation = build_relation(post_query, relation)