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:
parent
bfc3bc0733
commit
394f37cf66
|
@ -120,9 +120,8 @@ class Tag < ActiveRecord::Base
|
||||||
tag_names_with_counts.map { |row| row.tag_name }
|
tag_names_with_counts.map { |row| row.tag_name }
|
||||||
end
|
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?
|
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
|
user_id = allowed_user.id
|
||||||
|
|
||||||
DB.query_hash(<<~SQL).map!(&:symbolize_keys!)
|
DB.query_hash(<<~SQL).map!(&:symbolize_keys!)
|
||||||
|
@ -143,6 +142,7 @@ class Tag < ActiveRecord::Base
|
||||||
AND gu.group_id = tg.group_id
|
AND gu.group_id = tg.group_id
|
||||||
)
|
)
|
||||||
GROUP BY tags.name
|
GROUP BY tags.name
|
||||||
|
ORDER BY count DESC
|
||||||
LIMIT #{limit}
|
LIMIT #{limit}
|
||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue