From a2441545db8ae331c74325e9882b9f223df5bdb8 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 6 Dec 2018 13:51:19 +0100 Subject: [PATCH] Add check inside method, like with playSoundNotification --- dist/converse.js | 8 +++++--- src/converse-notification.js | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dist/converse.js b/dist/converse.js index 51acf0901..c28c6fa1d 100644 --- a/dist/converse.js +++ b/dist/converse.js @@ -55787,6 +55787,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins /* Shows an HTML5 Notification to indicate that a new chat * message was received. */ + if (!_converse.areDesktopNotificationsEnabled()) { + return; + } + let title, roster_item; const full_from_jid = message.getAttribute('from'), from_jid = Strophe.getBareJidFromJid(full_from_jid); @@ -55918,9 +55922,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins _converse.playSoundNotification(); - if (_converse.areDesktopNotificationsEnabled()) { - _converse.showMessageNotification(message); - } + _converse.showMessageNotification(message); }; _converse.handleContactRequestNotification = function (contact) { diff --git a/src/converse-notification.js b/src/converse-notification.js index bd61e86b5..eb3300e20 100644 --- a/src/converse-notification.js +++ b/src/converse-notification.js @@ -138,6 +138,9 @@ converse.plugins.add('converse-notification', { /* Shows an HTML5 Notification to indicate that a new chat * message was received. */ + if (!_converse.areDesktopNotificationsEnabled()) { + return; + } let title, roster_item; const full_from_jid = message.getAttribute('from'), from_jid = Strophe.getBareJidFromJid(full_from_jid); @@ -259,9 +262,7 @@ converse.plugins.add('converse-notification', { return false; } _converse.playSoundNotification(); - if (_converse.areDesktopNotificationsEnabled()) { - _converse.showMessageNotification(message); - } + _converse.showMessageNotification(message); }; _converse.handleContactRequestNotification = function (contact) {