FIX: New counts were taking into account muted categories

This commit is contained in:
Robin Ward 2014-02-27 12:35:33 -05:00
parent 70ca6171d1
commit fee9870427
2 changed files with 8 additions and 0 deletions

View File

@ -136,6 +136,10 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
countNew: function(category_name){
return _.chain(this.states)
.where({last_read_post_number: null})
.where(function(topic) {
return topic.notification_level === null ||
topic.notification_level >= Discourse.Topic.NotificationLevel.TRACKING;
})
.where(function(topic){ return topic.category_name === category_name || !category_name;})
.value()
.length;

View File

@ -133,6 +133,10 @@ class TopicTrackingState
JOIN group_users gu ON gu.user_id = u.id AND cg.group_id = gu.group_id
WHERE c2.read_restricted )
)
AND NOT EXISTS( SELECT 1 FROM category_users cu
WHERE cu.user_id = u.id AND
cu.category_id = topics.category_id AND
cu.notification_level = #{CategoryUser.notification_levels[:muted]})
SQL