diff --git a/app/assets/javascripts/discourse/models/topic_tracking_state.js b/app/assets/javascripts/discourse/models/topic_tracking_state.js index 19d6a4dd693..a3051534dce 100644 --- a/app/assets/javascripts/discourse/models/topic_tracking_state.js +++ b/app/assets/javascripts/discourse/models/topic_tracking_state.js @@ -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;}) diff --git a/app/models/topic_tracking_state.rb b/app/models/topic_tracking_state.rb index 7e51acd489a..4a1d9e80eb2 100644 --- a/app/models/topic_tracking_state.rb +++ b/app/models/topic_tracking_state.rb @@ -44,7 +44,7 @@ class TopicTrackingState 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 = { @@ -54,7 +54,8 @@ class TopicTrackingState 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 } }