Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

message_viewport: Rename at_bottom for clarity.

Tim Abbott42956e03056e
diff --git a/web/src/message_scroll.js b/web/src/message_scroll.js
index efa231c7f74..647e7f0cac0 100644
--- a/web/src/message_scroll.js
+++ b/web/src/message_scroll.js
@@ -88,7 +88,7 @@ export function scroll_finished() {
});
}
- if (message_viewport.at_bottom()) {
+ if (message_viewport.at_rendered_bottom()) {
message_fetch.maybe_load_newer_messages({
msg_list: message_lists.current,
});
diff --git a/web/src/message_viewport.ts b/web/src/message_viewport.ts
index acd099ea1b7..34eba55cdfa 100644
--- a/web/src/message_viewport.ts
+++ b/web/src/message_viewport.ts
@@ -75,7 +75,7 @@ export function message_viewport_info(): MessageViewportInfo {
// rendered message feed; messages that are not displayed due to a
// limited render window or because they have not been fetched from
// the server are not considered.
-export function at_bottom(): boolean {
+export function at_rendered_bottom(): boolean {
const bottom = scrollTop() + height();
const full_height = $scroll_container.prop("scrollHeight");
@@ -86,8 +86,9 @@ export function at_bottom(): boolean {
return bottom + 2 >= full_height;
}
-// 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.
+// This differs from at_rendered_bottom in that it only requires the
+// bottom message to be visible, but you may be able to scroll down
+// further to see the rest of that message.
export function bottom_rendered_message_visible(): boolean {
const $last_row = rows.last_visible();
if ($last_row.length) {
@@ -485,7 +486,7 @@ export function keep_pointer_in_view(): void {
}
function message_is_far_enough_up(): boolean {
- return at_bottom() || $next_row.get_offset_to_window().top <= bottom_threshold;
+ return at_rendered_bottom() || $next_row.get_offset_to_window().top <= bottom_threshold;
}
function adjust(
diff --git a/web/src/navigate.js b/web/src/navigate.js
index e0ee50bb77e..7526cc38926 100644
--- a/web/src/navigate.js
+++ b/web/src/navigate.js
@@ -108,7 +108,7 @@ export function page_up() {
}
export function page_down() {
- if (message_viewport.at_bottom() && !message_lists.current.visibly_empty()) {
+ if (message_viewport.at_rendered_bottom() && !message_lists.current.visibly_empty()) {
message_lists.current.select_id(message_lists.current.last().id, {then_scroll: false});
unread_ops.process_visible();
} else {
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index 657a0eeeb88..08b93983b4f 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -199,7 +199,7 @@ export function initialize_kitchen_sink_stuff() {
if (delta < 0 && message_viewport.at_top()) {
navigate.up();
- } else if (delta > 0 && message_viewport.at_bottom()) {
+ } else if (delta > 0 && message_viewport.at_rendered_bottom()) {
navigate.down();
}