Fix #4343: Presence of metatags shouldn't prevent rendering of the excerpt.

On the post index page, show the wiki excerpt if the search includes a
single tag, even if the tag is negated or the search includes other
metatags.

If the search includes a single pool: or ordpool: metatag, show the pool
excerpt even if the search includes other metatags.
This commit is contained in:
evazion
2020-04-30 18:17:02 -05:00
parent 8b5763652d
commit 3d3f9ce46c
3 changed files with 101 additions and 10 deletions

View File

@@ -823,8 +823,8 @@ class PostQueryBuilder
scan_query.select { |term| term.type == :metatag }
end
def select_metatags(metatag)
metatags.select { |term| term.name == metatag.to_s.downcase }
def select_metatags(*names)
metatags.select { |term| term.name.in?(names.map(&:to_s)) }
end
def find_metatag(metatag)
@@ -835,6 +835,10 @@ class PostQueryBuilder
metatags.any? { |term| term.name.in?(metatag_names.map(&:to_s).map(&:downcase)) }
end
def has_single_tag?
tags.size == 1 && !tags.first.wildcard
end
def is_metatag?(name, value = nil)
if value.nil?
is_single_term? && has_metatag?(name)