FIX: Inconsistency between unread counter and unread filter
This commit is contained in:
parent
c5d6f6a034
commit
f1486c7728
|
@ -157,6 +157,8 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
|
|||
list.topics.forEach(function(topic){
|
||||
var row = tracker.states["t" + topic.id] || {};
|
||||
row.topic_id = topic.id;
|
||||
row.notification_level = topic.notification_level;
|
||||
|
||||
|
||||
if (topic.unseen) {
|
||||
row.last_read_post_number = null;
|
||||
|
|
|
@ -18,7 +18,8 @@ class ListableTopicSerializer < BasicTopicSerializer
|
|||
:excerpt,
|
||||
:visible,
|
||||
:closed,
|
||||
:archived
|
||||
:archived,
|
||||
:notification_level
|
||||
|
||||
has_one :last_poster, serializer: BasicUserSerializer, embed: :objects
|
||||
def include_last_poster?
|
||||
|
@ -40,6 +41,13 @@ class ListableTopicSerializer < BasicTopicSerializer
|
|||
!seen
|
||||
end
|
||||
|
||||
def notification_level
|
||||
object.user_data.notification_level
|
||||
end
|
||||
def include_notification_level?
|
||||
object.user_data.present?
|
||||
end
|
||||
|
||||
def last_read_post_number
|
||||
return nil unless object.user_data
|
||||
object.user_data.last_read_post_number
|
||||
|
|
|
@ -147,7 +147,7 @@ class TopicQuery
|
|||
end
|
||||
|
||||
def self.unread_filter(list)
|
||||
list.where("tu.last_read_post_number < topics.highest_post_number")
|
||||
list.where("tu.seen_post_count < topics.highest_post_number")
|
||||
.where("COALESCE(tu.notification_level, :regular) >= :tracking", regular: TopicUser.notification_levels[:regular], tracking: TopicUser.notification_levels[:tracking])
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue