Add check inside method, like with playSoundNotification

This commit is contained in:
JC Brand 2018-12-06 13:51:19 +01:00
parent 362e94d7f5
commit a2441545db
2 changed files with 9 additions and 6 deletions

8
dist/converse.js vendored
View File

@ -55787,6 +55787,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
/* Shows an HTML5 Notification to indicate that a new chat /* Shows an HTML5 Notification to indicate that a new chat
* message was received. * message was received.
*/ */
if (!_converse.areDesktopNotificationsEnabled()) {
return;
}
let title, roster_item; let title, roster_item;
const full_from_jid = message.getAttribute('from'), const full_from_jid = message.getAttribute('from'),
from_jid = Strophe.getBareJidFromJid(full_from_jid); from_jid = Strophe.getBareJidFromJid(full_from_jid);
@ -55918,9 +55922,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.playSoundNotification(); _converse.playSoundNotification();
if (_converse.areDesktopNotificationsEnabled()) { _converse.showMessageNotification(message);
_converse.showMessageNotification(message);
}
}; };
_converse.handleContactRequestNotification = function (contact) { _converse.handleContactRequestNotification = function (contact) {

View File

@ -138,6 +138,9 @@ converse.plugins.add('converse-notification', {
/* Shows an HTML5 Notification to indicate that a new chat /* Shows an HTML5 Notification to indicate that a new chat
* message was received. * message was received.
*/ */
if (!_converse.areDesktopNotificationsEnabled()) {
return;
}
let title, roster_item; let title, roster_item;
const full_from_jid = message.getAttribute('from'), const full_from_jid = message.getAttribute('from'),
from_jid = Strophe.getBareJidFromJid(full_from_jid); from_jid = Strophe.getBareJidFromJid(full_from_jid);
@ -259,9 +262,7 @@ converse.plugins.add('converse-notification', {
return false; return false;
} }
_converse.playSoundNotification(); _converse.playSoundNotification();
if (_converse.areDesktopNotificationsEnabled()) { _converse.showMessageNotification(message);
_converse.showMessageNotification(message);
}
}; };
_converse.handleContactRequestNotification = function (contact) { _converse.handleContactRequestNotification = function (contact) {