Fossil SCM

/chat: re-enable inclusion of unversioned sound files (mp3, wav, ogg) in the list of chat notification sounds. Corrected storage of selected audio URI to account for multiple sounds. Updated change log and chat.md.

stephan 2021-09-18 03:26 chat-config-options
Commit c23aa77411fdb65e4329a67eeafa6163019982522e1639690dc252482a989880
+6 -5
--- src/chat.js
+++ src/chat.js
@@ -386,11 +386,11 @@
386386
this.
387387
*/
388388
setNewMessageSound: function f(uri){
389389
delete this.playNewMessageSound.audio;
390390
this.playNewMessageSound.uri = uri;
391
- this.settings.set('audible-alert', !!uri);
391
+ this.settings.set('audible-alert', uri);
392392
return this;
393393
}
394394
};
395395
F.fetch.beforesend = ()=>cs.ajaxStart();
396396
F.fetch.aftersend = ()=>cs.ajaxEnd();
@@ -1017,27 +1017,27 @@
10171017
settingsOps.selectSound = D.addClass(D.div(), 'menu-entry');
10181018
const selectSound = D.select();
10191019
D.append(settingsOps.selectSound,
10201020
D.append(D.span(),"Audio alert"),
10211021
selectSound);
1022
- D.disable(D.option(selectSound, "0", "Audible alert..."));
10231022
D.option(selectSound, "", "(no audio)");
1023
+ const firstSoundIndex = selectSound.options.length;
10241024
F.config.chat.alerts.forEach(function(a){
10251025
D.option(selectSound, a);
10261026
});
10271027
if(true===Chat.settings.getBool('audible-alert')){
1028
- selectSound.selectedIndex = 2/*first audio file in the list*/;
1028
+ selectSound.selectedIndex = firstSoundIndex;
10291029
}else{
10301030
selectSound.value = Chat.settings.get('audible-alert','');
10311031
if(selectSound.selectedIndex<0){
10321032
/*Missing file - removed after this setting was applied. Fall back
10331033
to the first sound in the list. */
1034
- selectSound.selectedIndex = 2;
1034
+ selectSound.selectedIndex = firstSoundIndex;
10351035
}
10361036
}
10371037
selectSound.addEventListener('change',function(){
1038
- const v = this.selectedIndex>1 ? this.value : '';
1038
+ const v = this.value;
10391039
Chat.setNewMessageSound(v);
10401040
F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
10411041
if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
10421042
}, false);
10431043
Chat.setNewMessageSound(selectSound.value);
@@ -1074,10 +1074,11 @@
10741074
D.append(optionsMenu, line);
10751075
});
10761076
if(settingsOps.selectSound){
10771077
D.append(optionsMenu, settingsOps.selectSound);
10781078
}
1079
+ //settingsButton.click()/*for for development*/;
10791080
})()/*#chat-settings-button setup*/;
10801081
10811082
/** Callback for poll() to inject new content into the page. jx ==
10821083
the response from /chat-poll. If atEnd is true, the message is
10831084
appended to the end of the chat list (for loading older
10841085
--- src/chat.js
+++ src/chat.js
@@ -386,11 +386,11 @@
386 this.
387 */
388 setNewMessageSound: function f(uri){
389 delete this.playNewMessageSound.audio;
390 this.playNewMessageSound.uri = uri;
391 this.settings.set('audible-alert', !!uri);
392 return this;
393 }
394 };
395 F.fetch.beforesend = ()=>cs.ajaxStart();
396 F.fetch.aftersend = ()=>cs.ajaxEnd();
@@ -1017,27 +1017,27 @@
1017 settingsOps.selectSound = D.addClass(D.div(), 'menu-entry');
1018 const selectSound = D.select();
1019 D.append(settingsOps.selectSound,
1020 D.append(D.span(),"Audio alert"),
1021 selectSound);
1022 D.disable(D.option(selectSound, "0", "Audible alert..."));
1023 D.option(selectSound, "", "(no audio)");
 
1024 F.config.chat.alerts.forEach(function(a){
1025 D.option(selectSound, a);
1026 });
1027 if(true===Chat.settings.getBool('audible-alert')){
1028 selectSound.selectedIndex = 2/*first audio file in the list*/;
1029 }else{
1030 selectSound.value = Chat.settings.get('audible-alert','');
1031 if(selectSound.selectedIndex<0){
1032 /*Missing file - removed after this setting was applied. Fall back
1033 to the first sound in the list. */
1034 selectSound.selectedIndex = 2;
1035 }
1036 }
1037 selectSound.addEventListener('change',function(){
1038 const v = this.selectedIndex>1 ? this.value : '';
1039 Chat.setNewMessageSound(v);
1040 F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
1041 if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
1042 }, false);
1043 Chat.setNewMessageSound(selectSound.value);
@@ -1074,10 +1074,11 @@
1074 D.append(optionsMenu, line);
1075 });
1076 if(settingsOps.selectSound){
1077 D.append(optionsMenu, settingsOps.selectSound);
1078 }
 
1079 })()/*#chat-settings-button setup*/;
1080
1081 /** Callback for poll() to inject new content into the page. jx ==
1082 the response from /chat-poll. If atEnd is true, the message is
1083 appended to the end of the chat list (for loading older
1084
--- src/chat.js
+++ src/chat.js
@@ -386,11 +386,11 @@
386 this.
387 */
388 setNewMessageSound: function f(uri){
389 delete this.playNewMessageSound.audio;
390 this.playNewMessageSound.uri = uri;
391 this.settings.set('audible-alert', uri);
392 return this;
393 }
394 };
395 F.fetch.beforesend = ()=>cs.ajaxStart();
396 F.fetch.aftersend = ()=>cs.ajaxEnd();
@@ -1017,27 +1017,27 @@
1017 settingsOps.selectSound = D.addClass(D.div(), 'menu-entry');
1018 const selectSound = D.select();
1019 D.append(settingsOps.selectSound,
1020 D.append(D.span(),"Audio alert"),
1021 selectSound);
 
1022 D.option(selectSound, "", "(no audio)");
1023 const firstSoundIndex = selectSound.options.length;
1024 F.config.chat.alerts.forEach(function(a){
1025 D.option(selectSound, a);
1026 });
1027 if(true===Chat.settings.getBool('audible-alert')){
1028 selectSound.selectedIndex = firstSoundIndex;
1029 }else{
1030 selectSound.value = Chat.settings.get('audible-alert','');
1031 if(selectSound.selectedIndex<0){
1032 /*Missing file - removed after this setting was applied. Fall back
1033 to the first sound in the list. */
1034 selectSound.selectedIndex = firstSoundIndex;
1035 }
1036 }
1037 selectSound.addEventListener('change',function(){
1038 const v = this.value;
1039 Chat.setNewMessageSound(v);
1040 F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+".");
1041 if(v) setTimeout(()=>Chat.playNewMessageSound(), 0);
1042 }, false);
1043 Chat.setNewMessageSound(selectSound.value);
@@ -1074,10 +1074,11 @@
1074 D.append(optionsMenu, line);
1075 });
1076 if(settingsOps.selectSound){
1077 D.append(optionsMenu, settingsOps.selectSound);
1078 }
1079 //settingsButton.click()/*for for development*/;
1080 })()/*#chat-settings-button setup*/;
1081
1082 /** Callback for poll() to inject new content into the page. jx ==
1083 the response from /chat-poll. If atEnd is true, the message is
1084 appended to the end of the chat list (for loading older
1085
+1 -1
--- src/default.css
+++ src/default.css
@@ -1922,11 +1922,11 @@
19221922
}
19231923
body.chat #chat-config #chat-config-options .menu-entry {
19241924
display: flex;
19251925
align-items: center;
19261926
flex-direction: row;
1927
- flex-wrap: nowrap;
1927
+ flex-wrap: wrap;
19281928
padding: 1em;
19291929
}
19301930
body.chat #chat-config #chat-config-options .menu-entry > *:first-child {
19311931
margin-right: 1em;
19321932
}
19331933
--- src/default.css
+++ src/default.css
@@ -1922,11 +1922,11 @@
1922 }
1923 body.chat #chat-config #chat-config-options .menu-entry {
1924 display: flex;
1925 align-items: center;
1926 flex-direction: row;
1927 flex-wrap: nowrap;
1928 padding: 1em;
1929 }
1930 body.chat #chat-config #chat-config-options .menu-entry > *:first-child {
1931 margin-right: 1em;
1932 }
1933
--- src/default.css
+++ src/default.css
@@ -1922,11 +1922,11 @@
1922 }
1923 body.chat #chat-config #chat-config-options .menu-entry {
1924 display: flex;
1925 align-items: center;
1926 flex-direction: row;
1927 flex-wrap: wrap;
1928 padding: 1em;
1929 }
1930 body.chat #chat-config #chat-config-options .menu-entry > *:first-child {
1931 margin-right: 1em;
1932 }
1933
--- www/changes.wiki
+++ www/changes.wiki
@@ -36,10 +36,13 @@
3636
* The [/help?cmd=wiki|wiki list command] no longer lists "deleted"
3737
pages by default. Use the new <tt>--all</tt> option to include deleted
3838
pages in the output.
3939
* The [/help?cmd=all|fossil all git status] command only shows reports for
4040
the subset of repositories that have a configured Git export.
41
+ * Enhanced the [/help?cmd=/chat|/chat page] configuration and added the ability
42
+ for a repository administrator to [./chat.md#notifications|extend the
43
+ selection of notification sounds via unversioned files].
4144
4245
<h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2>
4346
* <b>Security:</b> Fix the client-side TLS so that it verifies that the
4447
server hostname matches its certificate.
4548
* The default "ssh" command on Windows is changed to "ssh" instead of the
4649
--- www/changes.wiki
+++ www/changes.wiki
@@ -36,10 +36,13 @@
36 * The [/help?cmd=wiki|wiki list command] no longer lists "deleted"
37 pages by default. Use the new <tt>--all</tt> option to include deleted
38 pages in the output.
39 * The [/help?cmd=all|fossil all git status] command only shows reports for
40 the subset of repositories that have a configured Git export.
 
 
 
41
42 <h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2>
43 * <b>Security:</b> Fix the client-side TLS so that it verifies that the
44 server hostname matches its certificate.
45 * The default "ssh" command on Windows is changed to "ssh" instead of the
46
--- www/changes.wiki
+++ www/changes.wiki
@@ -36,10 +36,13 @@
36 * The [/help?cmd=wiki|wiki list command] no longer lists "deleted"
37 pages by default. Use the new <tt>--all</tt> option to include deleted
38 pages in the output.
39 * The [/help?cmd=all|fossil all git status] command only shows reports for
40 the subset of repositories that have a configured Git export.
41 * Enhanced the [/help?cmd=/chat|/chat page] configuration and added the ability
42 for a repository administrator to [./chat.md#notifications|extend the
43 selection of notification sounds via unversioned files].
44
45 <h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2>
46 * <b>Security:</b> Fix the client-side TLS so that it verifies that the
47 server hostname matches its certificate.
48 * The default "ssh" command on Windows is changed to "ssh" instead of the
49
--- www/chat.md
+++ www/chat.md
@@ -99,10 +99,18 @@
9999
is reloaded. The user who posted a given message, or any Admin users,
100100
may additionally choose to globally delete a message from the chat
101101
record, which deletes it not only from their own browser but also
102102
propagates the removal to all connected clients the next time they
103103
poll for new messages.
104
+
105
+### <a id='notifications'></a>Customizing New-message Notification Sounds
106
+
107
+By default, the list of new-message notification sounds is limited to
108
+a few built in to the fossil binary. In addition, any
109
+[unversioned files](./unvers.wiki) named `alert-sounds/*.{mp3,wav,ogg}`
110
+will be included in that list. To switch sounds, tap the "settings"
111
+button.
104112
105113
## Implementation Details
106114
107115
*You do not need to understand how Fossil chat works in order to use it.
108116
But many developers prefer to know how their tools work.
109117
--- www/chat.md
+++ www/chat.md
@@ -99,10 +99,18 @@
99 is reloaded. The user who posted a given message, or any Admin users,
100 may additionally choose to globally delete a message from the chat
101 record, which deletes it not only from their own browser but also
102 propagates the removal to all connected clients the next time they
103 poll for new messages.
 
 
 
 
 
 
 
 
104
105 ## Implementation Details
106
107 *You do not need to understand how Fossil chat works in order to use it.
108 But many developers prefer to know how their tools work.
109
--- www/chat.md
+++ www/chat.md
@@ -99,10 +99,18 @@
99 is reloaded. The user who posted a given message, or any Admin users,
100 may additionally choose to globally delete a message from the chat
101 record, which deletes it not only from their own browser but also
102 propagates the removal to all connected clients the next time they
103 poll for new messages.
104
105 ### <a id='notifications'></a>Customizing New-message Notification Sounds
106
107 By default, the list of new-message notification sounds is limited to
108 a few built in to the fossil binary. In addition, any
109 [unversioned files](./unvers.wiki) named `alert-sounds/*.{mp3,wav,ogg}`
110 will be included in that list. To switch sounds, tap the "settings"
111 button.
112
113 ## Implementation Details
114
115 *You do not need to understand how Fossil chat works in order to use it.
116 But many developers prefer to know how their tools work.
117

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button