mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Sync unread state live to topic lists (#7933)
This commit is contained in:
@@ -22,6 +22,11 @@ const DiscoveryTopicsListComponent = Ember.Component.extend(
|
||||
}
|
||||
},
|
||||
|
||||
@observes("topicTrackingState.states")
|
||||
_updateTopics() {
|
||||
this.topicTrackingState.updateTopics(this.model.topics);
|
||||
},
|
||||
|
||||
@observes("incomingCount")
|
||||
_updateTitle() {
|
||||
Discourse.updateContextCount(this.incomingCount);
|
||||
|
||||
@@ -69,13 +69,10 @@ const TopicTrackingState = Discourse.Model.extend({
|
||||
if (["new_topic", "unread", "read"].includes(data.message_type)) {
|
||||
tracker.notify(data);
|
||||
const old = tracker.states["t" + data.topic_id];
|
||||
|
||||
// don't add tracking state for read stuff that was not tracked in first place
|
||||
if (old || data.message_type !== "read") {
|
||||
if (!_.isEqual(old, data.payload)) {
|
||||
tracker.states["t" + data.topic_id] = data.payload;
|
||||
tracker.incrementMessageCount();
|
||||
}
|
||||
if (!_.isEqual(old, data.payload)) {
|
||||
tracker.states["t" + data.topic_id] = data.payload;
|
||||
tracker.notifyPropertyChange("states");
|
||||
tracker.incrementMessageCount();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user