From e8b4bd708e7379032e25f4ca072e0a9f00f5d7f3 Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 27 Aug 2015 17:01:06 -0700 Subject: [PATCH] Fix lint warnings --- js/background.js | 16 ++++++++++------ js/panel_controller.js | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/js/background.js b/js/background.js index 143b5abc..0690a851 100644 --- a/js/background.js +++ b/js/background.js @@ -162,6 +162,13 @@ // lazy hack window.receipts = new Backbone.Collection(); + function updateConversation(conversationId) { + var conversation = ConversationController.get(conversationId); + if (conversation) { + conversation.reload(); + } + } + function onDeliveryReceipt(ev) { var pushMessage = ev.proto; var timestamp = pushMessage.timestamp.toNumber(); @@ -175,13 +182,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() { + message.save({delivered: deliveries + 1}).then( // notify frontend listeners - var conversation = ConversationController.get(conversationId); - if (conversation) { - conversation.reload(); - } - }); + updateConversation.bind(null, 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 ac7455dc..270d9d22 100644 --- a/js/panel_controller.js +++ b/js/panel_controller.js @@ -124,7 +124,7 @@ openInbox(); var appWindow = chrome.app.window.get(inboxWindowId); appWindow.contentWindow.trigger('open', {conversation: conversation}); - }; + } /* Inbox window controller */ var inboxOpened = false;