FIX: Make sure the unread counter is updated following a "Dismiss New"
This commit is contained in:
parent
feaaf55a0c
commit
f527ac33b0
|
@ -81,7 +81,16 @@ Discourse.DiscoveryTopicsController = Discourse.DiscoveryController.extend({
|
|||
} else {
|
||||
promise = Discourse.Topic.bulkOperationByFilter(this.get('filter'), operation);
|
||||
}
|
||||
promise.then(function() { self.send('refresh'); });
|
||||
promise.then(function(result) {
|
||||
if (result && result.topic_ids) {
|
||||
var tracker = Discourse.TopicTrackingState.current();
|
||||
result.topic_ids.forEach(function(t) {
|
||||
tracker.removeTopic(t);
|
||||
});
|
||||
tracker.incrementMessageCount();
|
||||
}
|
||||
self.send('refresh');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
|
|||
this._super();
|
||||
this.unreadSequence = [];
|
||||
this.newSequence = [];
|
||||
|
||||
this.states = {};
|
||||
},
|
||||
|
||||
|
@ -13,7 +12,6 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
|
|||
var tracker = this;
|
||||
|
||||
var process = function(data){
|
||||
|
||||
if (data.message_type === "delete") {
|
||||
tracker.removeTopic(data.topic_id);
|
||||
tracker.incrementMessageCount();
|
||||
|
@ -28,7 +26,6 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
|
|||
tracker.incrementMessageCount();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Discourse.MessageBus.subscribe("/new", process);
|
||||
|
|
Loading…
Reference in New Issue