diff --git a/js/background.js b/js/background.js index f9dac988..083bed23 100644 --- a/js/background.js +++ b/js/background.js @@ -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? diff --git a/js/panel_controller.js b/js/panel_controller.js index 955e16b6..05c14898 100644 --- a/js/panel_controller.js +++ b/js/panel_controller.js @@ -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); };