tag_aliases/index: fix tag category search options excluding empty tags.

Fix Tag.search to not filter out empty tags by default. Set the default
in the tags controller instead.

Fixes various search pages, namely aliases/implications/wiki pages, that
rely on Tag.search and that don't expect it to filter tags out by default.
This commit is contained in:
evazion
2020-03-06 19:07:17 -06:00
parent 6d2dd0303f
commit 57ba5c59a4
2 changed files with 3 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ class TagsController < ApplicationController
end
def index
@tags = Tag.paginated_search(params)
@tags = Tag.paginated_search(params, hide_empty: true)
@tags = @tags.includes(:consequent_aliases) if request.format.html?
respond_with(@tags)
end

View File

@@ -847,8 +847,8 @@ class Tag < ApplicationRecord
q = q.name_or_alias_matches(params[:name_or_alias_matches])
end
if params[:hide_empty].blank? || params[:hide_empty].to_s.truthy?
q = q.where("post_count > 0")
if params[:hide_empty].to_s.truthy?
q = q.nonempty
end
if params[:has_wiki].to_s.truthy?