Commit dfd86d6c authored by Novokreshchenov Konstantin's avatar Novokreshchenov Konstantin Committed by JC Brand

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

* save unread message count (num_unread) to server

* update CHANGES.md
parent b07e6291
...@@ -9,6 +9,7 @@ ...@@ -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)
......
...@@ -339,12 +339,12 @@ ...@@ -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 @@ ...@@ -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();
} }
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment