Reduce unnecessary updates on conversations at startup
This commit is contained in:
parent
280f7a74b1
commit
ace59147ab
2 changed files with 10 additions and 6 deletions
|
@ -188,12 +188,15 @@
|
|||
return collection.fetchConversation(this.id, 1).then(function() {
|
||||
var lastMessage = collection.at(0);
|
||||
if (lastMessage) {
|
||||
this.save({
|
||||
this.set({
|
||||
lastMessage : lastMessage.getNotificationText(),
|
||||
timestamp : lastMessage.get('sent_at')
|
||||
});
|
||||
} else {
|
||||
this.save({ lastMessage: '', timestamp: null });
|
||||
this.set({ lastMessage: '', timestamp: null });
|
||||
}
|
||||
if (this.hasChanged('lastMessage') || this.hasChanged('timestamp')) {
|
||||
this.save();
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue