ConversationView.markRead: Mark all messages read when at bottom
To handle the same 'not quite at the bottom' case that our 30px buffer gives us for marking messages read, we use the same atBottom() method to determine whether we should mark everything unread. Saves the effort and potential missed messages (due to partial pixels, etc.). FREEBIE
This commit is contained in:
parent
6bfeb7ab14
commit
da8d49b5ed
1 changed files with 12 additions and 4 deletions
|
@ -217,7 +217,8 @@
|
|||
},
|
||||
updateUnread: function() {
|
||||
this.resetLastSeenIndicator();
|
||||
this.markRead();
|
||||
// Waiting for scrolling caused by resetLastSeenIndicator to settle down
|
||||
setTimeout(this.markRead.bind(this), 1);
|
||||
},
|
||||
|
||||
onOpened: function() {
|
||||
|
@ -418,7 +419,7 @@
|
|||
|
||||
onClick: function(e) {
|
||||
this.closeMenu(e);
|
||||
this.markRead(e);
|
||||
this.markRead();
|
||||
},
|
||||
|
||||
findNewestVisibleUnread: function() {
|
||||
|
@ -468,8 +469,15 @@
|
|||
}
|
||||
},
|
||||
|
||||
markRead: function(e) {
|
||||
var unread = this.findNewestVisibleUnread();
|
||||
markRead: function() {
|
||||
var unread;
|
||||
|
||||
if (this.view.atBottom()) {
|
||||
unread = this.model.messageCollection.last();
|
||||
} else {
|
||||
unread = this.findNewestVisibleUnread();
|
||||
}
|
||||
|
||||
if (unread) {
|
||||
this.model.markRead(unread.get('received_at'));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue