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

@@ -27,7 +27,7 @@ module PostSets
end
def tag
return nil unless query.is_simple_tag?
return nil unless query.has_single_tag?
@tag ||= Tag.find_by(name: query.tags.first.name)
end
@@ -38,15 +38,17 @@ module PostSets
end
def pool
return nil unless query.is_metatag?(:pool) || query.is_metatag?(:ordpool)
name = query.find_metatag(:pool) || query.find_metatag(:ordpool)
pool_names = query.select_metatags(:pool, :ordpool).map(&:value)
name = pool_names.first
return nil unless pool_names.size == 1
@pool ||= Pool.find_by_name(name)
end
def favgroup
return nil unless query.is_metatag?(:favgroup)
name = query.find_metatag(:favgroup)
favgroup_names = query.select_metatags(:favgroup, :ordfavgroup).map(&:value)
name = favgroup_names.first
return nil unless favgroup_names.size == 1
@favgroup ||= FavoriteGroup.visible(CurrentUser.user).find_by_name_or_id(name, CurrentUser.user)
end