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.
This commit is contained in:
Arpit Jalan 2020-11-10 02:39:59 +05:30 committed by GitHub
parent bfc3bc0733
commit 394f37cf66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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