BUGFIX: not notifying unread and new counts correctly

This commit is contained in:
Sam 2014-06-06 15:17:02 +10:00
parent 3767080f3b
commit 41b15d1ad1
2 changed files with 5 additions and 3 deletions

View File

@ -134,7 +134,8 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
return _.chain(this.states) return _.chain(this.states)
.where({last_read_post_number: null}) .where({last_read_post_number: null})
.where(function(topic) { .where(function(topic) {
return topic.notification_level === null || // !0 is true
return (topic.notification_level !== 0 && !topic.notification_level) ||
topic.notification_level >= Discourse.Topic.NotificationLevel.TRACKING; topic.notification_level >= Discourse.Topic.NotificationLevel.TRACKING;
}) })
.where(function(topic){ return topic.category_name === category_name || !category_name;}) .where(function(topic){ return topic.category_name === category_name || !category_name;})

View File

@ -44,7 +44,7 @@ class TopicTrackingState
TopicUser TopicUser
.tracking(post.topic_id) .tracking(post.topic_id)
.select([:user_id,:last_read_post_number]) .select([:user_id,:last_read_post_number, :notification_level])
.each do |tu| .each do |tu|
message = { message = {
@ -54,7 +54,8 @@ class TopicTrackingState
last_read_post_number: tu.last_read_post_number, last_read_post_number: tu.last_read_post_number,
highest_post_number: post.post_number, highest_post_number: post.post_number,
created_at: post.created_at, created_at: post.created_at,
topic_id: post.topic_id topic_id: post.topic_id,
notification_level: tu.notification_level
} }
} }