Automatically mark the open conversation read

If a conversation view is visible, it will automatically mark the
conversation read.

// FREEBIE
This commit is contained in:
lilia 2015-09-15 20:50:00 -07:00
parent 15a366dbf0
commit 9809894fd2

View file

@ -24,6 +24,7 @@
this.listenTo(this.model, 'destroy', this.stopListening);
this.listenTo(this.model, 'change:name', this.updateTitle);
this.listenTo(this.model, 'newmessages', this.fetchMessages);
this.listenTo(this.model, 'change:unreadCount', this.onUnread);
this.render();
@ -104,6 +105,12 @@
this.model.markRead();
},
onUnread: function(model, previous) {
if (!this.isHidden()) {
this.markRead();
}
},
verifyIdentity: function() {
if (this.model.isPrivate()) {
var their_number = this.model.id;
@ -233,12 +240,16 @@
},
forceUpdateMessageFieldSize: function (event) {
if (this.$el.css('display') === 'none') {
if (this.isHidden()) {
return;
}
this.view.scrollToBottomIfNeeded();
window.autosize.update(this.$messageField);
this.updateMessageFieldSize(event);
},
isHidden: function() {
return (this.$el.css('display') === 'none');
}
});
})();