Skip to content

A platform for community discussion. Free, open, simple.

FIX: `default_tags_muted` site setting won't have tag ids.

Vinoth Kannan618a7ecb3582
diff --git a/lib/topic_query.rb b/lib/topic_query.rb
index bef2eb3f24f..ec6133ca747 100644
--- a/lib/topic_query.rb
+++ b/lib/topic_query.rb
@@ -917,7 +917,8 @@ class TopicQuery
if user.present?
muted_tag_ids = TagUser.lookup(user, :muted).pluck(:tag_id)
else
- muted_tag_ids = SiteSetting.default_tags_muted.split("|").map(&:to_i)
+ muted_tag_names = SiteSetting.default_tags_muted.split("|")
+ muted_tag_ids = Tag.where(name: muted_tag_names).pluck(:id)
end
if muted_tag_ids.blank?
diff --git a/spec/components/topic_query_spec.rb b/spec/components/topic_query_spec.rb
index d36b7cd81e2..0b238cbd229 100644
--- a/spec/components/topic_query_spec.rb
+++ b/spec/components/topic_query_spec.rb
@@ -286,7 +286,7 @@ describe TopicQuery do
before do
SiteSetting.remove_muted_tags_from_latest = 'always'
- SiteSetting.default_tags_muted = tag.id.to_s
+ SiteSetting.default_tags_muted = tag.name
end
it 'removes default muted tag topics for anonymous users' do