FIX: New counts were taking into account muted categories
This commit is contained in:
parent
70ca6171d1
commit
fee9870427
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue