Mark conversation as read if open and window focused

Messages that are received in the active conversation while the window
is focused, are automatically marked as read.

The conversation appears as unread for a split second as the incoming message
arrives but it gets marked as read as soon as the message is displayed.
pull/749/head
OdysseasKr 10 years ago committed by lilia
parent 86edcc06c2
commit 83298b8979

@ -30,9 +30,10 @@
updateUnreadCount: function(model, count) {
var prev = model.previous('unreadCount') || 0;
var newUnreadCount = storage.get("unreadCount", 0) - (prev - count);
setUnreadCount(newUnreadCount);
storage.remove("unreadCount");
storage.put("unreadCount", newUnreadCount);
setUnreadCount(newUnreadCount);
}
}))();

@ -109,6 +109,10 @@
addMessage: function(message) {
this.model.messageCollection.add(message, {merge: true});
if (!this.isHidden() && window.isFocused()) {
this.markRead();
}
},
viewMembers: function() {

Loading…
Cancel
Save