Fossil SCM
Chat help text cleanups and add a FIXME regarding connection failure (as opposed to HTTP-level errors) while polling for new chat messages (which is not a new problem, but is one which came up while working on fts5-chat-search).
Commit
4711a8c4ddd2e14af03b092c59311ad21f055fb92509d4e7fedac820cf60f9e3
Parent
874a1bb920b1a5b…
1 file changed
+19
-3
+19
-3
| --- src/fossil.page.chat.js | ||
| +++ src/fossil.page.chat.js | ||
| @@ -1881,12 +1881,13 @@ | ||
| 1881 | 1881 | boolValue: 'edit-ctrl-send' |
| 1882 | 1882 | },{ |
| 1883 | 1883 | label: "Compact mode", |
| 1884 | 1884 | hint: [ |
| 1885 | 1885 | "Toggle between a space-saving or more spacious writing area. ", |
| 1886 | - "When the input field has focus, is empty, and preview mode ", | |
| 1887 | - "is NOT active then Shift-Enter toggles this setting."].join(''), | |
| 1886 | + "When the input field has focus and is empty ", | |
| 1887 | + "then Shift-Enter may (depending on the current view) toggle this setting." | |
| 1888 | + ].join(''), | |
| 1888 | 1889 | boolValue: 'edit-compact-mode' |
| 1889 | 1890 | },{ |
| 1890 | 1891 | label: "Use 'contenteditable' editing mode", |
| 1891 | 1892 | boolValue: 'edit-widget-x', |
| 1892 | 1893 | hint: [ |
| @@ -2127,11 +2128,11 @@ | ||
| 2127 | 2128 | s.value ? 'add' : 'remove' |
| 2128 | 2129 | ]('compact'); |
| 2129 | 2130 | Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus(); |
| 2130 | 2131 | }); |
| 2131 | 2132 | Chat.settings.addListener('edit-ctrl-send',function(s){ |
| 2132 | - const label = "Submit message ("+(s.value ? "Ctrl-" : "")+"Enter)"; | |
| 2133 | + const label = (s.value ? "Ctrl-" : "")+"Enter submits message"; | |
| 2133 | 2134 | Chat.e.inputFields.forEach((e)=>{ |
| 2134 | 2135 | const v = e.dataset.placeholder0 + " " +label; |
| 2135 | 2136 | if(e.isContentEditable) e.dataset.placeholder = v; |
| 2136 | 2137 | else D.attr(e,'placeholder',v); |
| 2137 | 2138 | }); |
| @@ -2458,10 +2459,25 @@ | ||
| 2458 | 2459 | delete Chat.intervalTimer; |
| 2459 | 2460 | } |
| 2460 | 2461 | poll.running = false; |
| 2461 | 2462 | }; |
| 2462 | 2463 | afterFetch.isFirstCall = true; |
| 2464 | + /** | |
| 2465 | + FIXME: when polling fails because the remote server is | |
| 2466 | + reachable but it's not accepting HTTP requests, we should back | |
| 2467 | + off on polling for a while. e.g. if the remote web server process | |
| 2468 | + is killed, the poll fails quickly and immediately retries, | |
| 2469 | + hammering the remote server until the httpd is back up. That | |
| 2470 | + happens often during development of this application. | |
| 2471 | + | |
| 2472 | + XHR does not offer a direct way of distinguishing between | |
| 2473 | + HTTP/connection errors, but we can hypothetically use the | |
| 2474 | + xhrRequest.status value to do so, with status==0 being a | |
| 2475 | + connection error. We do not currently have a clean way of passing | |
| 2476 | + that info back to the fossil.fetch() client, so we'll need to | |
| 2477 | + hammer on that API a bit to get this working. | |
| 2478 | + */ | |
| 2463 | 2479 | const poll = async function f(){ |
| 2464 | 2480 | if(f.running) return; |
| 2465 | 2481 | f.running = true; |
| 2466 | 2482 | Chat._isBatchLoading = f.isFirstCall; |
| 2467 | 2483 | if(true===f.isFirstCall){ |
| 2468 | 2484 |
| --- src/fossil.page.chat.js | |
| +++ src/fossil.page.chat.js | |
| @@ -1881,12 +1881,13 @@ | |
| 1881 | boolValue: 'edit-ctrl-send' |
| 1882 | },{ |
| 1883 | label: "Compact mode", |
| 1884 | hint: [ |
| 1885 | "Toggle between a space-saving or more spacious writing area. ", |
| 1886 | "When the input field has focus, is empty, and preview mode ", |
| 1887 | "is NOT active then Shift-Enter toggles this setting."].join(''), |
| 1888 | boolValue: 'edit-compact-mode' |
| 1889 | },{ |
| 1890 | label: "Use 'contenteditable' editing mode", |
| 1891 | boolValue: 'edit-widget-x', |
| 1892 | hint: [ |
| @@ -2127,11 +2128,11 @@ | |
| 2127 | s.value ? 'add' : 'remove' |
| 2128 | ]('compact'); |
| 2129 | Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus(); |
| 2130 | }); |
| 2131 | Chat.settings.addListener('edit-ctrl-send',function(s){ |
| 2132 | const label = "Submit message ("+(s.value ? "Ctrl-" : "")+"Enter)"; |
| 2133 | Chat.e.inputFields.forEach((e)=>{ |
| 2134 | const v = e.dataset.placeholder0 + " " +label; |
| 2135 | if(e.isContentEditable) e.dataset.placeholder = v; |
| 2136 | else D.attr(e,'placeholder',v); |
| 2137 | }); |
| @@ -2458,10 +2459,25 @@ | |
| 2458 | delete Chat.intervalTimer; |
| 2459 | } |
| 2460 | poll.running = false; |
| 2461 | }; |
| 2462 | afterFetch.isFirstCall = true; |
| 2463 | const poll = async function f(){ |
| 2464 | if(f.running) return; |
| 2465 | f.running = true; |
| 2466 | Chat._isBatchLoading = f.isFirstCall; |
| 2467 | if(true===f.isFirstCall){ |
| 2468 |
| --- src/fossil.page.chat.js | |
| +++ src/fossil.page.chat.js | |
| @@ -1881,12 +1881,13 @@ | |
| 1881 | boolValue: 'edit-ctrl-send' |
| 1882 | },{ |
| 1883 | label: "Compact mode", |
| 1884 | hint: [ |
| 1885 | "Toggle between a space-saving or more spacious writing area. ", |
| 1886 | "When the input field has focus and is empty ", |
| 1887 | "then Shift-Enter may (depending on the current view) toggle this setting." |
| 1888 | ].join(''), |
| 1889 | boolValue: 'edit-compact-mode' |
| 1890 | },{ |
| 1891 | label: "Use 'contenteditable' editing mode", |
| 1892 | boolValue: 'edit-widget-x', |
| 1893 | hint: [ |
| @@ -2127,11 +2128,11 @@ | |
| 2128 | s.value ? 'add' : 'remove' |
| 2129 | ]('compact'); |
| 2130 | Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus(); |
| 2131 | }); |
| 2132 | Chat.settings.addListener('edit-ctrl-send',function(s){ |
| 2133 | const label = (s.value ? "Ctrl-" : "")+"Enter submits message"; |
| 2134 | Chat.e.inputFields.forEach((e)=>{ |
| 2135 | const v = e.dataset.placeholder0 + " " +label; |
| 2136 | if(e.isContentEditable) e.dataset.placeholder = v; |
| 2137 | else D.attr(e,'placeholder',v); |
| 2138 | }); |
| @@ -2458,10 +2459,25 @@ | |
| 2459 | delete Chat.intervalTimer; |
| 2460 | } |
| 2461 | poll.running = false; |
| 2462 | }; |
| 2463 | afterFetch.isFirstCall = true; |
| 2464 | /** |
| 2465 | FIXME: when polling fails because the remote server is |
| 2466 | reachable but it's not accepting HTTP requests, we should back |
| 2467 | off on polling for a while. e.g. if the remote web server process |
| 2468 | is killed, the poll fails quickly and immediately retries, |
| 2469 | hammering the remote server until the httpd is back up. That |
| 2470 | happens often during development of this application. |
| 2471 | |
| 2472 | XHR does not offer a direct way of distinguishing between |
| 2473 | HTTP/connection errors, but we can hypothetically use the |
| 2474 | xhrRequest.status value to do so, with status==0 being a |
| 2475 | connection error. We do not currently have a clean way of passing |
| 2476 | that info back to the fossil.fetch() client, so we'll need to |
| 2477 | hammer on that API a bit to get this working. |
| 2478 | */ |
| 2479 | const poll = async function f(){ |
| 2480 | if(f.running) return; |
| 2481 | f.running = true; |
| 2482 | Chat._isBatchLoading = f.isFirstCall; |
| 2483 | if(true===f.isFirstCall){ |
| 2484 |