Digest should exclude muted topics.

This commit is contained in:
Robin Ward 2014-04-17 15:21:55 -04:00
parent 89aa2380c6
commit 564b1d86b0
1 changed files with 3 additions and 1 deletions

View File

@ -266,10 +266,12 @@ class Topic < ActiveRecord::Base
topics = Topic
.visible
.secured(Guardian.new(user))
.joins("LEFT OUTER JOIN top_topics ON top_topics.topic_id = topics.id")
.joins("LEFT OUTER JOIN topic_users ON topic_users.topic_id = topics.id AND topic_users.user_id = #{user.id.to_i}")
.where(closed: false, archived: false)
.where("COALESCE(topic_users.notification_level, 1) <> ?", TopicUser.notification_levels[:muted])
.created_since(since)
.listable_topics
.joins("LEFT OUTER JOIN top_topics ON top_topics.topic_id = topics.id")
.order(TopicQuerySQL.order_top_for(score))
.limit(100)