Stop calling updateInbox all the time

Now that the inbox collection keeps itself in sync, we don't have the
data duplication that was forcing us to reload constantly.

// FREEBIE
pull/749/head
lilia 10 years ago
parent 537f0ceef0
commit b617240338

@ -89,8 +89,6 @@
active_at : now, active_at : now,
timestamp : now, timestamp : now,
lastMessage : body lastMessage : body
}).then(function() {
ConversationController.updateInbox();
}); });
var sendFunc; var sendFunc;
@ -113,9 +111,7 @@
} }
}); });
if (keyErrors.length) { if (keyErrors.length) {
message.save({ errors : keyErrors }).then(function() { message.save({ errors : keyErrors });
ConversationController.updateInbox();
});
} else { } else {
if (!(errors instanceof Array)) { if (!(errors instanceof Array)) {
errors = [errors]; errors = [errors];
@ -198,18 +194,11 @@
}.bind(this)); }.bind(this));
}, },
archive: function() {
this.set({active_at: null});
},
destroyMessages: function() { destroyMessages: function() {
var models = this.messageCollection.models; var models = this.messageCollection.models;
this.messageCollection.reset([]); this.messageCollection.reset([]);
_.each(models, function(message) { message.destroy(); }); _.each(models, function(message) { message.destroy(); });
this.archive(); this.save({active_at: null}); // archive
return this.save().then(function() {
ConversationController.updateInbox();
});
}, },
getTitle: function() { getTitle: function() {

@ -50,7 +50,6 @@
}); });
} else { } else {
openConversation(conversation); openConversation(conversation);
ConversationController.updateInbox();
} }
}; };

Loading…
Cancel
Save