diff options
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/user_settings.jsx | 2 | ||||
-rw-r--r-- | web/react/utils/utils.jsx | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx index 0dfea6543..ad7de40bf 100644 --- a/web/react/components/user_settings.jsx +++ b/web/react/components/user_settings.jsx @@ -13,7 +13,7 @@ var assign = require('object-assign'); function getNotificationsStateFromStores() { var user = UserStore.getCurrentUser(); - var soundNeeded = (!navigator || !navigator.userAgent || navigator.userAgent.toLowerCase().indexOf("firefox") === -1); + var soundNeeded = !utils.checkBrowserType('firefox'); var sound = (!user.notify_props || user.notify_props.desktop_sound == undefined) ? "true" : user.notify_props.desktop_sound; var desktop = (!user.notify_props || user.notify_props.desktop == undefined) ? "all" : user.notify_props.desktop; var email = (!user.notify_props || user.notify_props.email == undefined) ? "true" : user.notify_props.email; diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 6236e11dd..ba48f0b1b 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -124,7 +124,7 @@ module.exports.notifyMe = function(title, body, channel) { } module.exports.ding = function() { - if (!navigator || !navigator.userAgent || navigator.userAgent.toLowerCase().indexOf("firefox") === -1) { + if (!module.exports.checkBrowserType('firefox')) { var audio = new Audio('/static/images/ding.mp3'); audio.play(); } @@ -936,3 +936,7 @@ module.exports.generateId = function() { return id; }; + +module.exports.checkBrowserType = function(browser) { + return navigator && navigator.userAgent && navigator.userAgent.toLowerCase().indexOf(browser.toLowerCase()) > -1 +} |