From 2a1e8ef39b0a285f70ba75bddc64bd6453c0400f Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 4 Mar 2016 15:29:33 +0000 Subject: [PATCH] Make audio notifs only play if the sound tweak is set --- src/Notifier.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Notifier.js b/src/Notifier.js index 8e60aee24c..3dbbf5cb82 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -35,7 +35,7 @@ var Notifier = { return TextForEvent.textForEvent(ev); }, - displayNotification: function(ev, room) { + displayNotification: function(ev, room, actions) { if (!global.Notification || global.Notification.permission != 'granted') { return; } @@ -94,7 +94,9 @@ var Notifier = { }; var audioClip; - audioClip = playAudio(); + if (actions.tweaks.sound) { + audioClip = playAudio(); + } global.setTimeout(function() { notification.close(); @@ -207,7 +209,7 @@ var Notifier = { var actions = MatrixClientPeg.get().getPushActionsForEvent(ev); if (actions && actions.notify) { - this.displayNotification(ev, room); + this.displayNotification(ev, room, actions); } } }; @@ -216,4 +218,4 @@ if (!global.mxNotifier) { global.mxNotifier = Notifier; } -module.exports = global.mxNotifier; \ No newline at end of file +module.exports = global.mxNotifier;