Update conversation snippets automatically
Fixes stale snippets after the message has expired
This commit is contained in:
parent
8d16bfb65e
commit
56aee5e8ef
2 changed files with 14 additions and 0 deletions
|
@ -167,6 +167,18 @@
|
|||
}.bind(this));
|
||||
},
|
||||
|
||||
updateLastMessage: function() {
|
||||
var lastMessage = this.messageCollection.at(this.messageCollection.length - 1);
|
||||
if (lastMessage) {
|
||||
this.save({
|
||||
lastMessage : lastMessage.getNotificationText(),
|
||||
timestamp : lastMessage.get('sent_at')
|
||||
});
|
||||
} else {
|
||||
this.save({ lastMessage: '', timestamp: null });
|
||||
}
|
||||
},
|
||||
|
||||
addExpirationTimerUpdate: function(time, source) {
|
||||
var now = Date.now();
|
||||
this.save({ expireTimer: time });
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
this.listenTo(this.model, 'change', _.debounce(this.render.bind(this), 1000));
|
||||
this.listenTo(this.model, 'destroy', this.remove); // auto update
|
||||
this.listenTo(this.model, 'opened', this.markSelected); // auto update
|
||||
this.listenTo(this.model.messageCollection, 'add remove',
|
||||
_.debounce(this.model.updateLastMessage.bind(this.model), 1000));
|
||||
extension.windows.onClosed(this.stopListening.bind(this));
|
||||
this.timeStampView = new Whisper.TimestampView({brief: true});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue