From 0b22bb25c1791a25d1f4901cd0acd99bae795f3e Mon Sep 17 00:00:00 2001 From: nickago Date: Wed, 12 Aug 2015 15:27:46 -0700 Subject: Handed control of notification sounds over to browser for firefox --- web/react/components/user_settings.jsx | 47 ++++++++++++++++++++++------------ web/react/utils/utils.jsx | 6 +++-- 2 files changed, 35 insertions(+), 18 deletions(-) (limited to 'web') diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx index 1a0c313d3..d2d72884b 100644 --- a/web/react/components/user_settings.jsx +++ b/web/react/components/user_settings.jsx @@ -13,6 +13,7 @@ var assign = require('object-assign'); function getNotificationsStateFromStores() { var user = UserStore.getCurrentUser(); + var soundNeeded = (!navigator || navigator.userAgent.toLowerCase().indexOf("firefox") === -1); 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; @@ -58,7 +59,7 @@ function getNotificationsStateFromStores() { } } - return { notify_level: desktop, enable_email: email, enable_sound: sound, username_key: username_key, mention_key: mention_key, custom_keys: custom_keys, custom_keys_checked: custom_keys.length > 0, first_name_key: first_name_key, all_key: all_key, channel_key: channel_key }; + return { notify_level: desktop, enable_email: email, soundNeeded: soundNeeded, enable_sound: sound, username_key: username_key, mention_key: mention_key, custom_keys: custom_keys, custom_keys_checked: custom_keys.length > 0, first_name_key: first_name_key, all_key: all_key, channel_key: channel_key }; } @@ -236,23 +237,35 @@ var NotificationsTab = React.createClass({ var soundSection; if (this.props.activeSection === 'sound') { - var soundActive = ["",""]; - if (this.state.enable_sound === "false") { - soundActive[1] = "active"; - } else { - soundActive[0] = "active"; - } - var inputs = []; - inputs.push( -
-
- - + if(this.state.soundNeeded) { + var soundActive = ["",""]; + if (this.state.enable_sound === "false") { + soundActive[1] = "active"; + } else { + soundActive[0] = "active"; + } + + inputs.push( +
+
+ + +
-
- ); + ); + } else { + inputs.push( +
+
+ + +
+

Please disable notification sounds in your browser settings
+
+ ) + } soundSection = (