Fossil SCM
chat: reconnected the audible-alert persistent toggle to the new way of storing the sound file config.
Commit
2f0bf9dabd4f4c6fd3016104f8aa4727c25e16fb14ee85b06f690c7555441cba
Parent
4c384ba2f4be309…
1 file changed
+5
-2
+5
-2
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -375,11 +375,11 @@ | ||
| 375 | 375 | setting is true, else this is a no-op. Returns this. |
| 376 | 376 | */ |
| 377 | 377 | playNewMessageSound: function f(){ |
| 378 | 378 | if(f.uri){ |
| 379 | 379 | try{ |
| 380 | - if(!f.audio) f.audio = new Audio(window.fossil.config.chat.alertSound); | |
| 380 | + if(!f.audio) f.audio = new Audio(f.uri); | |
| 381 | 381 | f.audio.currentTime = 0; |
| 382 | 382 | f.audio.play(); |
| 383 | 383 | }catch(e){ |
| 384 | 384 | console.error("Audio playblack failed.",e); |
| 385 | 385 | } |
| @@ -967,15 +967,18 @@ | ||
| 967 | 967 | settingsOps.push({ |
| 968 | 968 | label: "Audible alerts", |
| 969 | 969 | boolValue: ()=>Chat.settings.getBool('audible-alert'), |
| 970 | 970 | callback: function(){ |
| 971 | 971 | const v = Chat.settings.toggle('audible-alert'); |
| 972 | - Chat.setNewMessageSound(v ? 'builtin/alerts/plunk.wav' : false); | |
| 972 | + Chat.setNewMessageSound(v ? F.config.chat.alertSound : false); | |
| 973 | 973 | if(v) setTimeout(()=>Chat.playNewMessageSound(), 50); |
| 974 | 974 | F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+"."); |
| 975 | 975 | } |
| 976 | 976 | }); |
| 977 | + Chat.setNewMessageSound( | |
| 978 | + Chat.settings.getBool('audible-alert') ? F.config.chat.alertSound : false | |
| 979 | + ); | |
| 977 | 980 | }else{ |
| 978 | 981 | /* Disabled per chatroom discussion: selection list of audio files for |
| 979 | 982 | chat notification. */ |
| 980 | 983 | const selectSound = settingsOps.selectSound = D.addClass(D.select(), 'menu-entry'); |
| 981 | 984 | D.disable(D.option(selectSound, "0", "Audible alert...")); |
| 982 | 985 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -375,11 +375,11 @@ | |
| 375 | setting is true, else this is a no-op. Returns this. |
| 376 | */ |
| 377 | playNewMessageSound: function f(){ |
| 378 | if(f.uri){ |
| 379 | try{ |
| 380 | if(!f.audio) f.audio = new Audio(window.fossil.config.chat.alertSound); |
| 381 | f.audio.currentTime = 0; |
| 382 | f.audio.play(); |
| 383 | }catch(e){ |
| 384 | console.error("Audio playblack failed.",e); |
| 385 | } |
| @@ -967,15 +967,18 @@ | |
| 967 | settingsOps.push({ |
| 968 | label: "Audible alerts", |
| 969 | boolValue: ()=>Chat.settings.getBool('audible-alert'), |
| 970 | callback: function(){ |
| 971 | const v = Chat.settings.toggle('audible-alert'); |
| 972 | Chat.setNewMessageSound(v ? 'builtin/alerts/plunk.wav' : false); |
| 973 | if(v) setTimeout(()=>Chat.playNewMessageSound(), 50); |
| 974 | F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+"."); |
| 975 | } |
| 976 | }); |
| 977 | }else{ |
| 978 | /* Disabled per chatroom discussion: selection list of audio files for |
| 979 | chat notification. */ |
| 980 | const selectSound = settingsOps.selectSound = D.addClass(D.select(), 'menu-entry'); |
| 981 | D.disable(D.option(selectSound, "0", "Audible alert...")); |
| 982 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -375,11 +375,11 @@ | |
| 375 | setting is true, else this is a no-op. Returns this. |
| 376 | */ |
| 377 | playNewMessageSound: function f(){ |
| 378 | if(f.uri){ |
| 379 | try{ |
| 380 | if(!f.audio) f.audio = new Audio(f.uri); |
| 381 | f.audio.currentTime = 0; |
| 382 | f.audio.play(); |
| 383 | }catch(e){ |
| 384 | console.error("Audio playblack failed.",e); |
| 385 | } |
| @@ -967,15 +967,18 @@ | |
| 967 | settingsOps.push({ |
| 968 | label: "Audible alerts", |
| 969 | boolValue: ()=>Chat.settings.getBool('audible-alert'), |
| 970 | callback: function(){ |
| 971 | const v = Chat.settings.toggle('audible-alert'); |
| 972 | Chat.setNewMessageSound(v ? F.config.chat.alertSound : false); |
| 973 | if(v) setTimeout(()=>Chat.playNewMessageSound(), 50); |
| 974 | F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+"."); |
| 975 | } |
| 976 | }); |
| 977 | Chat.setNewMessageSound( |
| 978 | Chat.settings.getBool('audible-alert') ? F.config.chat.alertSound : false |
| 979 | ); |
| 980 | }else{ |
| 981 | /* Disabled per chatroom discussion: selection list of audio files for |
| 982 | chat notification. */ |
| 983 | const selectSound = settingsOps.selectSound = D.addClass(D.select(), 'menu-entry'); |
| 984 | D.disable(D.option(selectSound, "0", "Audible alert...")); |
| 985 |