@@ -24,6 +24,9 @@ var NotificationsStore = Reflux.createStore({
2424
2525 isNewNotification : function ( response ) {
2626 var self = this ;
27+ var playSound = SettingsStore . getSettings ( ) . playSound ;
28+ 29+ if ( ! playSound ) { return ; }
2730
2831 // Check if notification is already in the store.
2932 var isNew = false ;
@@ -35,8 +38,10 @@ var NotificationsStore = Reflux.createStore({
3538
3639 // Play Sound.
3740 if ( isNew ) {
38- var audio = new Audio ( 'sounds/digi.wav' ) ;
39- audio . play ( ) ;
41+ if ( playSound ) {
42+ var audio = new Audio ( 'sounds/digi.wav' ) ;
43+ audio . play ( ) ;
44+ }
4045 }
4146
4247 // Now Reset the previousNotifications array.
@@ -49,7 +54,6 @@ var NotificationsStore = Reflux.createStore({
4954 onGetNotifications : function ( ) {
5055 var self = this ;
5156 var participating = SettingsStore . getSettings ( ) . participating ;
52- var playSound = SettingsStore . getSettings ( ) . playSound ;
5357
5458 apiRequests
5559 . getAuth ( 'https://api.github.com/notifications?participating=' +
@@ -59,10 +63,7 @@ var NotificationsStore = Reflux.createStore({
5963 // Success - Do Something.
6064 Actions . getNotifications . completed ( response . body ) ;
6165 self . updateTrayIcon ( response . body ) ;
62- 63- if ( playSound ) {
64- self . isNewNotification ( response . body ) ;
65- }
66+ self . isNewNotification ( response . body ) ;
6667 } else {
6768 // Error - Show messages.
6869 Actions . getNotifications . failed ( err ) ;
0 commit comments