Skip to content

Commit

Permalink
BUGFIX: not notifying unread and new counts correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Jun 6, 2014
1 parent 3767080 commit 41b15d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
return _.chain(this.states)
.where({last_read_post_number: null})
.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;
})
.where(function(topic){ return topic.category_name === category_name || !category_name;})
Expand Down
5 changes: 3 additions & 2 deletions app/models/topic_tracking_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def self.publish_unread(post)

TopicUser
.tracking(post.topic_id)
.select([:user_id,:last_read_post_number])
.select([:user_id,:last_read_post_number, :notification_level])
.each do |tu|

message = {
Expand All @@ -54,7 +54,8 @@ def self.publish_unread(post)
last_read_post_number: tu.last_read_post_number,
highest_post_number: post.post_number,
created_at: post.created_at,
topic_id: post.topic_id
topic_id: post.topic_id,
notification_level: tu.notification_level
}
}

Expand Down

0 comments on commit 41b15d1

Please sign in to comment.