Fossil SCM
When batch loading chat messages, delay update of recent activity list until after the batch is done. Squeezed about 0.5em more space out of the screen.
Commit
7c2f3eb31faac3afe3f5d7562db4c39b699b0454baa1016fcab0299cd1cd92fc
Parent
dddd42baa6bbd96…
2 files changed
+8
-4
+3
-2
+8
-4
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -452,11 +452,12 @@ | ||
| 452 | 452 | }, |
| 453 | 453 | /** |
| 454 | 454 | Updates the "active user list" view. |
| 455 | 455 | */ |
| 456 | 456 | updateActiveUserList: function callee(){ |
| 457 | - if(!callee.sortUsersSeen){ | |
| 457 | + if(this._isBatchLoading) return this; | |
| 458 | + else if(!callee.sortUsersSeen){ | |
| 458 | 459 | /** Array.sort() callback. Expects an array of user names and |
| 459 | 460 | sorts them in last-received message order (newest first). */ |
| 460 | 461 | const usersLastSeen = this.usersLastSeen; |
| 461 | 462 | const self = this; |
| 462 | 463 | callee.sortUsersSeen = function(l,r){ |
| @@ -1389,16 +1390,15 @@ | ||
| 1389 | 1390 | } |
| 1390 | 1391 | const row = new Chat.MessageWidget(m); |
| 1391 | 1392 | Chat.injectMessageElem(row.e.body,atEnd); |
| 1392 | 1393 | if(m.isError){ |
| 1393 | 1394 | Chat._gotServerError = m; |
| 1394 | - }else{ | |
| 1395 | - Chat.updateActiveUserList(); | |
| 1396 | 1395 | } |
| 1397 | 1396 | }/*processPost()*/; |
| 1398 | 1397 | }/*end static init*/ |
| 1399 | 1398 | jx.msgs.forEach((m)=>f.processPost(m,atEnd)); |
| 1399 | + Chat.updateActiveUserList(); | |
| 1400 | 1400 | if('visible'===document.visibilityState){ |
| 1401 | 1401 | if(Chat.changesSincePageHidden){ |
| 1402 | 1402 | Chat.changesSincePageHidden = 0; |
| 1403 | 1403 | Chat.e.pageTitle.innerText = Chat.pageTitleOrig; |
| 1404 | 1404 | } |
| @@ -1439,10 +1439,11 @@ | ||
| 1439 | 1439 | }, |
| 1440 | 1440 | onload:function(x){ |
| 1441 | 1441 | let gotMessages = x.msgs.length; |
| 1442 | 1442 | newcontent(x,true); |
| 1443 | 1443 | Chat._isBatchLoading = false; |
| 1444 | + Chat.updateActiveUserList(); | |
| 1444 | 1445 | if(Chat._gotServerError){ |
| 1445 | 1446 | Chat._gotServerError = false; |
| 1446 | 1447 | return; |
| 1447 | 1448 | } |
| 1448 | 1449 | if(n<0/*we asked for all history*/ |
| @@ -1532,11 +1533,14 @@ | ||
| 1532 | 1533 | resumed, and reportError() produces a loud error message. */ |
| 1533 | 1534 | afterFetch(); |
| 1534 | 1535 | }, |
| 1535 | 1536 | onload:function(y){ |
| 1536 | 1537 | newcontent(y); |
| 1537 | - Chat._isBatchLoading = false; | |
| 1538 | + if(Chat._isBatchLoading){ | |
| 1539 | + Chat._isBatchLoading = false; | |
| 1540 | + Chat.updateActiveUserList(); | |
| 1541 | + } | |
| 1538 | 1542 | afterFetch(); |
| 1539 | 1543 | } |
| 1540 | 1544 | }); |
| 1541 | 1545 | }; |
| 1542 | 1546 | poll.isFirstCall = true; |
| 1543 | 1547 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -452,11 +452,12 @@ | |
| 452 | }, |
| 453 | /** |
| 454 | Updates the "active user list" view. |
| 455 | */ |
| 456 | updateActiveUserList: function callee(){ |
| 457 | if(!callee.sortUsersSeen){ |
| 458 | /** Array.sort() callback. Expects an array of user names and |
| 459 | sorts them in last-received message order (newest first). */ |
| 460 | const usersLastSeen = this.usersLastSeen; |
| 461 | const self = this; |
| 462 | callee.sortUsersSeen = function(l,r){ |
| @@ -1389,16 +1390,15 @@ | |
| 1389 | } |
| 1390 | const row = new Chat.MessageWidget(m); |
| 1391 | Chat.injectMessageElem(row.e.body,atEnd); |
| 1392 | if(m.isError){ |
| 1393 | Chat._gotServerError = m; |
| 1394 | }else{ |
| 1395 | Chat.updateActiveUserList(); |
| 1396 | } |
| 1397 | }/*processPost()*/; |
| 1398 | }/*end static init*/ |
| 1399 | jx.msgs.forEach((m)=>f.processPost(m,atEnd)); |
| 1400 | if('visible'===document.visibilityState){ |
| 1401 | if(Chat.changesSincePageHidden){ |
| 1402 | Chat.changesSincePageHidden = 0; |
| 1403 | Chat.e.pageTitle.innerText = Chat.pageTitleOrig; |
| 1404 | } |
| @@ -1439,10 +1439,11 @@ | |
| 1439 | }, |
| 1440 | onload:function(x){ |
| 1441 | let gotMessages = x.msgs.length; |
| 1442 | newcontent(x,true); |
| 1443 | Chat._isBatchLoading = false; |
| 1444 | if(Chat._gotServerError){ |
| 1445 | Chat._gotServerError = false; |
| 1446 | return; |
| 1447 | } |
| 1448 | if(n<0/*we asked for all history*/ |
| @@ -1532,11 +1533,14 @@ | |
| 1532 | resumed, and reportError() produces a loud error message. */ |
| 1533 | afterFetch(); |
| 1534 | }, |
| 1535 | onload:function(y){ |
| 1536 | newcontent(y); |
| 1537 | Chat._isBatchLoading = false; |
| 1538 | afterFetch(); |
| 1539 | } |
| 1540 | }); |
| 1541 | }; |
| 1542 | poll.isFirstCall = true; |
| 1543 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -452,11 +452,12 @@ | |
| 452 | }, |
| 453 | /** |
| 454 | Updates the "active user list" view. |
| 455 | */ |
| 456 | updateActiveUserList: function callee(){ |
| 457 | if(this._isBatchLoading) return this; |
| 458 | else if(!callee.sortUsersSeen){ |
| 459 | /** Array.sort() callback. Expects an array of user names and |
| 460 | sorts them in last-received message order (newest first). */ |
| 461 | const usersLastSeen = this.usersLastSeen; |
| 462 | const self = this; |
| 463 | callee.sortUsersSeen = function(l,r){ |
| @@ -1389,16 +1390,15 @@ | |
| 1390 | } |
| 1391 | const row = new Chat.MessageWidget(m); |
| 1392 | Chat.injectMessageElem(row.e.body,atEnd); |
| 1393 | if(m.isError){ |
| 1394 | Chat._gotServerError = m; |
| 1395 | } |
| 1396 | }/*processPost()*/; |
| 1397 | }/*end static init*/ |
| 1398 | jx.msgs.forEach((m)=>f.processPost(m,atEnd)); |
| 1399 | Chat.updateActiveUserList(); |
| 1400 | if('visible'===document.visibilityState){ |
| 1401 | if(Chat.changesSincePageHidden){ |
| 1402 | Chat.changesSincePageHidden = 0; |
| 1403 | Chat.e.pageTitle.innerText = Chat.pageTitleOrig; |
| 1404 | } |
| @@ -1439,10 +1439,11 @@ | |
| 1439 | }, |
| 1440 | onload:function(x){ |
| 1441 | let gotMessages = x.msgs.length; |
| 1442 | newcontent(x,true); |
| 1443 | Chat._isBatchLoading = false; |
| 1444 | Chat.updateActiveUserList(); |
| 1445 | if(Chat._gotServerError){ |
| 1446 | Chat._gotServerError = false; |
| 1447 | return; |
| 1448 | } |
| 1449 | if(n<0/*we asked for all history*/ |
| @@ -1532,11 +1533,14 @@ | |
| 1533 | resumed, and reportError() produces a loud error message. */ |
| 1534 | afterFetch(); |
| 1535 | }, |
| 1536 | onload:function(y){ |
| 1537 | newcontent(y); |
| 1538 | if(Chat._isBatchLoading){ |
| 1539 | Chat._isBatchLoading = false; |
| 1540 | Chat.updateActiveUserList(); |
| 1541 | } |
| 1542 | afterFetch(); |
| 1543 | } |
| 1544 | }); |
| 1545 | }; |
| 1546 | poll.isFirstCall = true; |
| 1547 |
+3
-2
| --- src/style.chat.css | ||
| +++ src/style.chat.css | ||
| @@ -138,10 +138,11 @@ | ||
| 138 | 138 | /** Container for the list of /chat messages. */ |
| 139 | 139 | body.chat #chat-messages-wrapper { |
| 140 | 140 | overflow: auto; |
| 141 | 141 | flex: 2 1 auto; |
| 142 | 142 | padding: 0 0.25em; |
| 143 | + margin-bottom: 0.5em; | |
| 143 | 144 | } |
| 144 | 145 | body.chat #chat-messages-wrapper.loading > * { |
| 145 | 146 | /* An attempt at reducing flicker when loading lots of messages. */ |
| 146 | 147 | visibility: hidden; |
| 147 | 148 | } |
| @@ -161,12 +162,12 @@ | ||
| 161 | 162 | } |
| 162 | 163 | /* Wrapper for /chat user input controls */ |
| 163 | 164 | body.chat #chat-input-area { |
| 164 | 165 | display: flex; |
| 165 | 166 | flex-direction: column; |
| 166 | - padding: 0.5em 0 0 0; | |
| 167 | - margin: 0.5em 0 0 0; | |
| 167 | + padding: 0; | |
| 168 | + margin: 0; | |
| 168 | 169 | position: initial /*sticky currently disabled due to scrolling-related issues*/; |
| 169 | 170 | /*bottom: 0;*/ |
| 170 | 171 | } |
| 171 | 172 | body.chat:not(.chat-only-mode) #chat-input-area{ |
| 172 | 173 | /* Safari user reports that 2em is necessary to keep the file selection |
| 173 | 174 |
| --- src/style.chat.css | |
| +++ src/style.chat.css | |
| @@ -138,10 +138,11 @@ | |
| 138 | /** Container for the list of /chat messages. */ |
| 139 | body.chat #chat-messages-wrapper { |
| 140 | overflow: auto; |
| 141 | flex: 2 1 auto; |
| 142 | padding: 0 0.25em; |
| 143 | } |
| 144 | body.chat #chat-messages-wrapper.loading > * { |
| 145 | /* An attempt at reducing flicker when loading lots of messages. */ |
| 146 | visibility: hidden; |
| 147 | } |
| @@ -161,12 +162,12 @@ | |
| 161 | } |
| 162 | /* Wrapper for /chat user input controls */ |
| 163 | body.chat #chat-input-area { |
| 164 | display: flex; |
| 165 | flex-direction: column; |
| 166 | padding: 0.5em 0 0 0; |
| 167 | margin: 0.5em 0 0 0; |
| 168 | position: initial /*sticky currently disabled due to scrolling-related issues*/; |
| 169 | /*bottom: 0;*/ |
| 170 | } |
| 171 | body.chat:not(.chat-only-mode) #chat-input-area{ |
| 172 | /* Safari user reports that 2em is necessary to keep the file selection |
| 173 |
| --- src/style.chat.css | |
| +++ src/style.chat.css | |
| @@ -138,10 +138,11 @@ | |
| 138 | /** Container for the list of /chat messages. */ |
| 139 | body.chat #chat-messages-wrapper { |
| 140 | overflow: auto; |
| 141 | flex: 2 1 auto; |
| 142 | padding: 0 0.25em; |
| 143 | margin-bottom: 0.5em; |
| 144 | } |
| 145 | body.chat #chat-messages-wrapper.loading > * { |
| 146 | /* An attempt at reducing flicker when loading lots of messages. */ |
| 147 | visibility: hidden; |
| 148 | } |
| @@ -161,12 +162,12 @@ | |
| 162 | } |
| 163 | /* Wrapper for /chat user input controls */ |
| 164 | body.chat #chat-input-area { |
| 165 | display: flex; |
| 166 | flex-direction: column; |
| 167 | padding: 0; |
| 168 | margin: 0; |
| 169 | position: initial /*sticky currently disabled due to scrolling-related issues*/; |
| 170 | /*bottom: 0;*/ |
| 171 | } |
| 172 | body.chat:not(.chat-only-mode) #chat-input-area{ |
| 173 | /* Safari user reports that 2em is necessary to keep the file selection |
| 174 |