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:
@@ -1390,7 +1390,8 @@ class Post < ApplicationRecord
|
||||
def user_tag_match(query, user = CurrentUser.user, tag_limit: user.tag_query_limit, safe_mode: CurrentUser.safe_mode?)
|
||||
post_query = PostQuery.normalize(query, current_user: user, tag_limit: tag_limit, safe_mode: safe_mode)
|
||||
post_query.validate_tag_limit!
|
||||
post_query.with_implicit_metatags.posts
|
||||
posts = post_query.with_implicit_metatags.posts
|
||||
merge(posts)
|
||||
end
|
||||
|
||||
def search(params, current_user)
|
||||
@@ -1408,7 +1409,7 @@ class Post < ApplicationRecord
|
||||
)
|
||||
|
||||
if params[:tags].present?
|
||||
q = q.user_tag_match(params[:tags])
|
||||
q = q.user_tag_match(params[:tags], current_user)
|
||||
end
|
||||
|
||||
if params[:order].present?
|
||||
|
||||
Reference in New Issue
Block a user