message_list: Extract visibly_empty helper method.

This function will allow us to adjust the codebase to write what it
means semantically -- whether a check is for the message list being
visibly empty, or completely empty.

In this commit, we leave the .empty() method incorrect, because
several other adjustments need to be made atomically with fixing it.
This commit is contained in:
Tim Abbott
2023-05-01 19:04:46 -07:00
parent 8f1c3a0fa1
commit 804f473214
13 changed files with 41 additions and 30 deletions

View File

@@ -139,7 +139,7 @@ export function hide_top_of_narrow_notices() {
let hide_scroll_to_bottom_timer;
export function hide_scroll_to_bottom() {
const $show_scroll_to_bottom_button = $("#scroll-to-bottom-button-container");
if (message_viewport.bottom_message_visible() || message_lists.current.empty()) {
if (message_viewport.bottom_message_visible() || message_lists.current.visibly_empty()) {
// If last message is visible, just hide the
// scroll to bottom button.
$show_scroll_to_bottom_button.removeClass("show");