FIX: 'default_categories_muted' site setting not working for anonymous users.

FIX: ‘default_categories_muted’ site setting not working for anonymous users.

diff --git a/lib/topic_query.rb b/lib/topic_query.rb
index ba29c16619..571f89d2fc 100644
--- a/lib/topic_query.rb
+++ b/lib/topic_query.rb
@@ -895,6 +895,11 @@ class TopicQuery
                regular: CategoryUser.notification_levels[:regular],
                tracking: TopicUser.notification_levels[:tracking],
                category_id: category_id || -1)
+    else
+      category_ids = SiteSetting.default_categories_muted.split("|").map(&:to_i)
+      category_ids -= [category_id] if category_id.present? && category_ids.include?(category_id)
+
+      list = list.where("topics.category_id NOT IN (?)", category_ids) if category_ids.present?
     end
 
     list

GitHub sha: 57bbcf4c

This commit has been mentioned on Discourse Meta. There might be relevant details there:

This commit has been mentioned on Discourse Meta. There might be relevant details there: