Remove an extension.trigger

No need to trigger an extension-wide event now that all our models live
in the background page. We can just update them more or less directly.
This commit is contained in:
lilia 2015-02-18 23:56:13 -08:00
parent 626b63ee7c
commit 06e8e0dca7
2 changed files with 12 additions and 3 deletions

View file

@ -218,9 +218,10 @@
var deliveries = message.get('delivered') || 0;
var conversationId = message.get('conversationId');
if (conversationId === pushMessage.source || groups.get(conversationId)) {
message.save({delivered: deliveries + 1}).then(function() {
extension.trigger('message', message); // notify frontend listeners
});
message.save({delivered: deliveries + 1}).then(
// notify frontend listeners
updateConversation.bind(window,conversationId)
);
return;
// TODO: consider keeping a list of numbers we've
// successfully delivered to?

View file

@ -29,6 +29,14 @@
return conversations.get(windowMap.modelIdFrom(windowId));
};
window.updateConversation = function(conversationId) {
var conversation = conversations.get(conversationId)
if (conversation) {
conversation.fetch();
conversation.fetchMessages();
}
};
function closeConversation (windowId) {
windowMap.remove('windowId', windowId);
};