From 618a7ecb35828e562b73aeadeb1b80c89c154e5d Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Wed, 26 Aug 2020 23:05:29 +0530 Subject: [PATCH] FIX: `default_tags_muted` site setting won't have tag ids. Instead it only have list of tag names separated by comma. 89fcb75af2b8abfd146ab9b70895db466c0d2a9d --- lib/topic_query.rb | 3 ++- spec/components/topic_query_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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