FIX: Hide links to muted topics and in categories list (#14761)

* FIX: Hide links to muted topics

* FIX: Hide muted topics in categories list on mobile
This commit is contained in:
Bianca Nenciu
2021-10-29 17:52:23 +03:00
committed by GitHub
parent 095421a1e1
commit cb0958fcea
4 changed files with 42 additions and 0 deletions
+7
View File
@@ -63,6 +63,13 @@ class CategoryList
category_featured_topics = CategoryFeaturedTopic.select([:category_id, :topic_id]).order(:rank)
@all_topics = Topic.where(id: category_featured_topics.map(&:topic_id))
if @guardian.authenticated?
@all_topics = @all_topics
.joins("LEFT JOIN topic_users tu ON topics.id = tu.topic_id AND tu.user_id = #{@guardian.user.id.to_i}")
.where('COALESCE(tu.notification_level,1) > :muted', muted: TopicUser.notification_levels[:muted])
end
@all_topics = @all_topics.includes(:last_poster) if @options[:include_topics]
@all_topics.each do |t|
# hint for the serializer