Fossil SCM
Only update the recent activity view when it's active or activated, not when it's hidden/inactive.
Commit
06196b19939b5fca0132177b6358ba7293d2d486d616b03f2d656de844c96013
Parent
c00002656a60314…
1 file changed
+11
-6
+11
-6
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -449,22 +449,25 @@ | ||
| 449 | 449 | if(e!==E) D.addClass(E,'hidden'); |
| 450 | 450 | }); |
| 451 | 451 | return this.e.currentView = D.removeClass(e,'hidden'); |
| 452 | 452 | }, |
| 453 | 453 | /** |
| 454 | - Updates the "active user list" view. | |
| 454 | + Updates the "active user list" view if we are not currently | |
| 455 | + batch-loading messages and if the active user list UI element | |
| 456 | + is active. | |
| 455 | 457 | */ |
| 456 | 458 | updateActiveUserList: function callee(){ |
| 457 | - if(this._isBatchLoading) return this; | |
| 458 | - else if(!callee.sortUsersSeen){ | |
| 459 | + if(this._isBatchLoading | |
| 460 | + || Chat.e.activeUserListWrapper.classList.contains('hidden')){ | |
| 461 | + return this; | |
| 462 | + }else if(!callee.sortUsersSeen){ | |
| 459 | 463 | /** Array.sort() callback. Expects an array of user names and |
| 460 | 464 | sorts them in last-received message order (newest first). */ |
| 461 | - const usersLastSeen = this.usersLastSeen; | |
| 462 | 465 | const self = this; |
| 463 | 466 | callee.sortUsersSeen = function(l,r){ |
| 464 | - l = usersLastSeen[l]; | |
| 465 | - r = usersLastSeen[r]; | |
| 467 | + l = self.usersLastSeen[l]; | |
| 468 | + r = self.usersLastSeen[r]; | |
| 466 | 469 | if(l && r) return r - l; |
| 467 | 470 | else if(l) return -1; |
| 468 | 471 | else if(r) return 1; |
| 469 | 472 | else return 0; |
| 470 | 473 | }; |
| @@ -1214,10 +1217,12 @@ | ||
| 1214 | 1217 | D.removeClass(Chat.e.viewMessages.querySelectorAll('.message-widget.hidden'), 'hidden'); |
| 1215 | 1218 | /*Ideally we'd scroll the final message into view |
| 1216 | 1219 | now, but because viewMessages is currently hidden behind |
| 1217 | 1220 | viewConfig, scrolling is a no-op. */ |
| 1218 | 1221 | Chat.scrollMessagesTo(1); |
| 1222 | + }else{ | |
| 1223 | + Chat.updateActiveUserList(); | |
| 1219 | 1224 | } |
| 1220 | 1225 | } |
| 1221 | 1226 | },{ |
| 1222 | 1227 | label: "Monospace message font", |
| 1223 | 1228 | boolValue: ()=>document.body.classList.contains('monospace-messages'), |
| 1224 | 1229 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -449,22 +449,25 @@ | |
| 449 | if(e!==E) D.addClass(E,'hidden'); |
| 450 | }); |
| 451 | return this.e.currentView = D.removeClass(e,'hidden'); |
| 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){ |
| 464 | l = usersLastSeen[l]; |
| 465 | r = usersLastSeen[r]; |
| 466 | if(l && r) return r - l; |
| 467 | else if(l) return -1; |
| 468 | else if(r) return 1; |
| 469 | else return 0; |
| 470 | }; |
| @@ -1214,10 +1217,12 @@ | |
| 1214 | D.removeClass(Chat.e.viewMessages.querySelectorAll('.message-widget.hidden'), 'hidden'); |
| 1215 | /*Ideally we'd scroll the final message into view |
| 1216 | now, but because viewMessages is currently hidden behind |
| 1217 | viewConfig, scrolling is a no-op. */ |
| 1218 | Chat.scrollMessagesTo(1); |
| 1219 | } |
| 1220 | } |
| 1221 | },{ |
| 1222 | label: "Monospace message font", |
| 1223 | boolValue: ()=>document.body.classList.contains('monospace-messages'), |
| 1224 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -449,22 +449,25 @@ | |
| 449 | if(e!==E) D.addClass(E,'hidden'); |
| 450 | }); |
| 451 | return this.e.currentView = D.removeClass(e,'hidden'); |
| 452 | }, |
| 453 | /** |
| 454 | Updates the "active user list" view if we are not currently |
| 455 | batch-loading messages and if the active user list UI element |
| 456 | is active. |
| 457 | */ |
| 458 | updateActiveUserList: function callee(){ |
| 459 | if(this._isBatchLoading |
| 460 | || Chat.e.activeUserListWrapper.classList.contains('hidden')){ |
| 461 | return this; |
| 462 | }else if(!callee.sortUsersSeen){ |
| 463 | /** Array.sort() callback. Expects an array of user names and |
| 464 | sorts them in last-received message order (newest first). */ |
| 465 | const self = this; |
| 466 | callee.sortUsersSeen = function(l,r){ |
| 467 | l = self.usersLastSeen[l]; |
| 468 | r = self.usersLastSeen[r]; |
| 469 | if(l && r) return r - l; |
| 470 | else if(l) return -1; |
| 471 | else if(r) return 1; |
| 472 | else return 0; |
| 473 | }; |
| @@ -1214,10 +1217,12 @@ | |
| 1217 | D.removeClass(Chat.e.viewMessages.querySelectorAll('.message-widget.hidden'), 'hidden'); |
| 1218 | /*Ideally we'd scroll the final message into view |
| 1219 | now, but because viewMessages is currently hidden behind |
| 1220 | viewConfig, scrolling is a no-op. */ |
| 1221 | Chat.scrollMessagesTo(1); |
| 1222 | }else{ |
| 1223 | Chat.updateActiveUserList(); |
| 1224 | } |
| 1225 | } |
| 1226 | },{ |
| 1227 | label: "Monospace message font", |
| 1228 | boolValue: ()=>document.body.classList.contains('monospace-messages'), |
| 1229 |