From 394f37cf66127b57f9c05848f7e70733883bd18d Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Tue, 10 Nov 2020 02:39:59 +0530 Subject: [PATCH] FIX: do not use "max_tags_in_filter_list" setting for showing PM tags (#11146) Ensure we do not respect max_tags_in_filter_list when showing the list of PM tags. This filter is used on a full page view and there is not point limiting it to a small number. The expectation is that PM tags are very rarely used, so a hard limit of 1000 should be safe for now. --- app/models/tag.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index b9a510175da..866adf3fce7 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -120,9 +120,8 @@ class Tag < ActiveRecord::Base tag_names_with_counts.map { |row| row.tag_name } end - def self.pm_tags(limit_arg: nil, guardian: nil, allowed_user: nil) + def self.pm_tags(limit: 1000, guardian: nil, allowed_user: nil) return [] if allowed_user.blank? || !(guardian || Guardian.new).can_tag_pms? - limit = limit_arg || SiteSetting.max_tags_in_filter_list user_id = allowed_user.id DB.query_hash(<<~SQL).map!(&:symbolize_keys!) @@ -143,6 +142,7 @@ class Tag < ActiveRecord::Base AND gu.group_id = tg.group_id ) GROUP BY tags.name + ORDER BY count DESC LIMIT #{limit} SQL end