#567 Unreaded message count reset on page load (#856)

* save unread message count (num_unread) to server

* update CHANGES.md
This commit is contained in:
Novokreshchenov Konstantin 2017-04-24 23:34:08 +03:00 committed by JC Brand
parent b07e6291ea
commit dfd86d6c35
2 changed files with 4 additions and 3 deletions

View File

@ -9,6 +9,7 @@
- Show unread messages next to roster contacts. [jcbrand] - Show unread messages next to roster contacts. [jcbrand]
- API change: the `message` event now returns a data object with `stanza` and - API change: the `message` event now returns a data object with `stanza` and
`chatbox` attributes, instead of just the stanza. [jcbrand] `chatbox` attributes, instead of just the stanza. [jcbrand]
- #567 Unreaded message count reset on page load [novokrest]
## 3.0.2 (2017-04-23) ## 3.0.2 (2017-04-23)

View File

@ -339,12 +339,12 @@
}, },
clearUnreadMessagesCounter: function () { clearUnreadMessagesCounter: function () {
this.model.set({'num_unread': 0}); this.model.save({'num_unread': 0});
this.render(); this.render();
}, },
updateUnreadMessagesCounter: function () { updateUnreadMessagesCounter: function () {
this.model.set({'num_unread': this.model.get('num_unread') + 1}); this.model.save({'num_unread': this.model.get('num_unread') + 1});
this.render(); this.render();
}, },
@ -462,7 +462,7 @@
var ls = this.model.pluck('num_unread'), var ls = this.model.pluck('num_unread'),
count = 0, i; count = 0, i;
for (i=0; i<ls.length; i++) { count += ls[i]; } for (i=0; i<ls.length; i++) { count += ls[i]; }
this.toggleview.model.set({'num_unread': count}); this.toggleview.model.save({'num_unread': count});
this.render(); this.render();
} }
}); });