From cce1fe5c4bd5f9344cb00500b8da720d6ad4398b Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 10 Apr 2017 12:45:58 -0700 Subject: [PATCH] Simplify openConversation Now that the InboxView is initialized in the background page context, we can manipulate it more directly, without going through a global function on the foreground window. // FREEBIE --- js/background.js | 12 ++++++------ js/panel_controller.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/js/background.js b/js/background.js index f370ebacc9..c9bf09057b 100644 --- a/js/background.js +++ b/js/background.js @@ -308,12 +308,7 @@ try { if (self.inboxView) { self.inboxView.remove(); } self.inboxView = new Whisper.InboxView({model: self, window: destWindow}); - destWindow.openConversation = function(conversation) { - if (conversation) { - self.inboxView.openConversation(null, conversation); - } - }; - destWindow.openConversation(getOpenConversation()); + self.openConversation(getOpenConversation()); return self.inboxView; @@ -321,6 +316,11 @@ console.log(e); } }); + }, + openConversation: function(conversation) { + if (this.inboxView && conversation) { + this.inboxView.openConversation(null, conversation); + } } }; diff --git a/js/panel_controller.js b/js/panel_controller.js index d46c69fda2..36c68ab0f0 100644 --- a/js/panel_controller.js +++ b/js/panel_controller.js @@ -97,7 +97,7 @@ var open; window.openConversation = function(conversation) { if (inboxOpened === true) { - appWindow.contentWindow.openConversation(conversation); + owsDesktopApp.openConversation(conversation); } else { open = conversation; }