From 57bbcf4c5db4a99d2e01324ee2f172b741fcc5f9 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Tue, 19 Nov 2019 07:48:16 +0530 Subject: [PATCH] FIX: 'default_categories_muted' site setting not working for anonymous users. --- lib/topic_query.rb | 5 +++++ 1 file changed, 5 insertions(+) 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