Ensure that expired messages are removed from the frontend
This commit is contained in:
parent
02ea4f2475
commit
1383dc141f
4 changed files with 24 additions and 3 deletions
|
@ -40,10 +40,14 @@
|
|||
|
||||
this.on('change:avatar', this.updateAvatarUrl);
|
||||
this.on('destroy', this.revokeAvatarUrl);
|
||||
this.on('read', this.countUnread);
|
||||
this.on('read', this.onReadMessage);
|
||||
},
|
||||
|
||||
countUnread: function() {
|
||||
onReadMessage: function(message) {
|
||||
if (this.messageCollection.get(message.id)) {
|
||||
this.messageCollection.get(message.id).fetch();
|
||||
}
|
||||
|
||||
return this.getUnread().then(function(unreadMessages) {
|
||||
this.save({unreadCount: unreadMessages.length});
|
||||
if (unreadMessages.length) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue