From 0a2146692c1c53eb75e4b561d66be30aa5819857 Mon Sep 17 00:00:00 2001
From: Yuya Ochiai <yuya0321@gmail.com>
Date: Wed, 12 Oct 2016 22:36:06 +0900
Subject: PLT-4261 Set silent parameter for Notification (#4192)

In the desktop app, there are two kinds of sound on notifications,
`Utils.ding()` and `new Notification()` on Windows and Mac.
This commit stops both if the account setting is set to off.
---
 webapp/stores/notification_store.jsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'webapp/stores/notification_store.jsx')

diff --git a/webapp/stores/notification_store.jsx b/webapp/stores/notification_store.jsx
index 917b86df8..02826d586 100644
--- a/webapp/stores/notification_store.jsx
+++ b/webapp/stores/notification_store.jsx
@@ -7,6 +7,7 @@ import Constants from 'utils/constants.jsx';
 import UserStore from './user_store.jsx';
 import ChannelStore from './channel_store.jsx';
 import PreferenceStore from './preference_store.jsx';
+import * as UserAgent from 'utils/user_agent.jsx';
 import * as Utils from 'utils/utils.jsx';
 import * as PostUtils from 'utils/post_utils.jsx';
 const ActionTypes = Constants.ActionTypes;
@@ -97,9 +98,10 @@ class NotificationStoreClass extends EventEmitter {
                 duration = parseInt(user.notify_props.desktop_duration, 10) * 1000;
             }
 
-            Utils.notifyMe(title, body, channel, teamId, duration);
+            const sound = !user.notify_props || user.notify_props.desktop_sound === 'true';
+            Utils.notifyMe(title, body, channel, teamId, duration, !sound);
 
-            if (!user.notify_props || user.notify_props.desktop_sound === 'true') {
+            if (sound && !UserAgent.isWindowsApp() && !UserAgent.isMacApp()) {
                 Utils.ding();
             }
         }
-- 
cgit v1.2.3-1-g7c22

