mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
message_viewport: Rename bottom_message_visible.
This commit is contained in:
@@ -14,7 +14,10 @@ import * as unread_ui from "./unread_ui";
|
||||
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.visibly_empty()) {
|
||||
if (
|
||||
message_viewport.bottom_rendered_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");
|
||||
@@ -34,7 +37,7 @@ export function hide_scroll_to_bottom() {
|
||||
}
|
||||
|
||||
export function show_scroll_to_bottom_button() {
|
||||
if (message_viewport.bottom_message_visible()) {
|
||||
if (message_viewport.bottom_rendered_message_visible()) {
|
||||
// Only show scroll to bottom button when
|
||||
// last message is not visible in the
|
||||
// current scroll position.
|
||||
|
||||
@@ -88,7 +88,7 @@ export function at_bottom(): boolean {
|
||||
|
||||
// This differs from at_bottom in that it only requires the bottom message to
|
||||
// be visible, but you may be able to scroll down further.
|
||||
export function bottom_message_visible(): boolean {
|
||||
export function bottom_rendered_message_visible(): boolean {
|
||||
const $last_row = rows.last_visible();
|
||||
if ($last_row.length) {
|
||||
const message_bottom = $last_row[0].getBoundingClientRect().bottom;
|
||||
|
||||
@@ -459,7 +459,7 @@ function process_scrolled_to_bottom() {
|
||||
export function process_visible() {
|
||||
if (
|
||||
viewport_is_visible_and_focused() &&
|
||||
message_viewport.bottom_message_visible() &&
|
||||
message_viewport.bottom_rendered_message_visible() &&
|
||||
message_lists.current.view.is_end_rendered()
|
||||
) {
|
||||
process_scrolled_to_bottom();
|
||||
|
||||
@@ -100,7 +100,7 @@ run_test("unread_ops", ({override}) => {
|
||||
$("#message_feed_container").show();
|
||||
|
||||
// Make our "test" message appear visible.
|
||||
override(message_viewport, "bottom_message_visible", () => true);
|
||||
override(message_viewport, "bottom_rendered_message_visible", () => true);
|
||||
|
||||
// Set message_lists.current containing messages that can be marked read
|
||||
override(message_lists.current, "all_messages", () => test_messages);
|
||||
|
||||
Reference in New Issue
Block a user