From 28a10908ab32186e948fb9bc757bab9febf7586b Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Mon, 18 Jul 2016 19:30:09 -0300 Subject: [PATCH] Fixed bug for injecting code --- app/ux/WebView.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/ux/WebView.js b/app/ux/WebView.js index 23586a0e..9a97954d 100644 --- a/app/ux/WebView.js +++ b/app/ux/WebView.js @@ -137,11 +137,16 @@ Ext.define('Rambox.ux.WebView',{ if ( me.notifications ) me.setNotifications(me.notifications); // Injected code to detect new messages - if ( me.record && me.record.get('js_unread') !== '' ) { - console.info('JS Injected to Detect New Messages', me.src); + if ( me.record ) { var js_unread = Ext.getStore('ServicesList').getById(me.record.get('type') === 'office365' ? 'outlook365' : me.record.get('type')).get('js_unread'); - console.log(js_unread); - webview.executeJavaScript(js_unread); + js_unread = me.type === 'custom' ? me.record.get('js_unread') : js_unread; + if ( js_unread !== '' ) { + console.groupCollapsed('JS Injected to Detect New Messages'); + console.info(me.type); + console.log(js_unread); + console.groupEnd() + webview.executeJavaScript(js_unread); + } } // Scroll always to top (bug)