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.

stephan 2021-09-23 12:41 chat-user-filter
Commit 7c2f3eb31faac3afe3f5d7562db4c39b699b0454baa1016fcab0299cd1cd92fc
2 files changed +8 -4 +3 -2
+8 -4
--- src/chat.js
+++ src/chat.js
@@ -452,11 +452,12 @@
452452
},
453453
/**
454454
Updates the "active user list" view.
455455
*/
456456
updateActiveUserList: function callee(){
457
- if(!callee.sortUsersSeen){
457
+ if(this._isBatchLoading) return this;
458
+ else if(!callee.sortUsersSeen){
458459
/** Array.sort() callback. Expects an array of user names and
459460
sorts them in last-received message order (newest first). */
460461
const usersLastSeen = this.usersLastSeen;
461462
const self = this;
462463
callee.sortUsersSeen = function(l,r){
@@ -1389,16 +1390,15 @@
13891390
}
13901391
const row = new Chat.MessageWidget(m);
13911392
Chat.injectMessageElem(row.e.body,atEnd);
13921393
if(m.isError){
13931394
Chat._gotServerError = m;
1394
- }else{
1395
- Chat.updateActiveUserList();
13961395
}
13971396
}/*processPost()*/;
13981397
}/*end static init*/
13991398
jx.msgs.forEach((m)=>f.processPost(m,atEnd));
1399
+ Chat.updateActiveUserList();
14001400
if('visible'===document.visibilityState){
14011401
if(Chat.changesSincePageHidden){
14021402
Chat.changesSincePageHidden = 0;
14031403
Chat.e.pageTitle.innerText = Chat.pageTitleOrig;
14041404
}
@@ -1439,10 +1439,11 @@
14391439
},
14401440
onload:function(x){
14411441
let gotMessages = x.msgs.length;
14421442
newcontent(x,true);
14431443
Chat._isBatchLoading = false;
1444
+ Chat.updateActiveUserList();
14441445
if(Chat._gotServerError){
14451446
Chat._gotServerError = false;
14461447
return;
14471448
}
14481449
if(n<0/*we asked for all history*/
@@ -1532,11 +1533,14 @@
15321533
resumed, and reportError() produces a loud error message. */
15331534
afterFetch();
15341535
},
15351536
onload:function(y){
15361537
newcontent(y);
1537
- Chat._isBatchLoading = false;
1538
+ if(Chat._isBatchLoading){
1539
+ Chat._isBatchLoading = false;
1540
+ Chat.updateActiveUserList();
1541
+ }
15381542
afterFetch();
15391543
}
15401544
});
15411545
};
15421546
poll.isFirstCall = true;
15431547
--- 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
--- src/style.chat.css
+++ src/style.chat.css
@@ -138,10 +138,11 @@
138138
/** Container for the list of /chat messages. */
139139
body.chat #chat-messages-wrapper {
140140
overflow: auto;
141141
flex: 2 1 auto;
142142
padding: 0 0.25em;
143
+ margin-bottom: 0.5em;
143144
}
144145
body.chat #chat-messages-wrapper.loading > * {
145146
/* An attempt at reducing flicker when loading lots of messages. */
146147
visibility: hidden;
147148
}
@@ -161,12 +162,12 @@
161162
}
162163
/* Wrapper for /chat user input controls */
163164
body.chat #chat-input-area {
164165
display: flex;
165166
flex-direction: column;
166
- padding: 0.5em 0 0 0;
167
- margin: 0.5em 0 0 0;
167
+ padding: 0;
168
+ margin: 0;
168169
position: initial /*sticky currently disabled due to scrolling-related issues*/;
169170
/*bottom: 0;*/
170171
}
171172
body.chat:not(.chat-only-mode) #chat-input-area{
172173
/* Safari user reports that 2em is necessary to keep the file selection
173174
--- 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

Keyboard Shortcuts

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