mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
message_fetch: Fetch again if the view is not scrollable.
If the initial fetch for the narrow didn't return enough data for the view to becomes scrollable, we should try to populate the narrow with more messages.
This commit is contained in:
@@ -17,6 +17,7 @@ import type {MessageListData} from "./message_list_data.ts";
|
||||
import * as message_lists from "./message_lists.ts";
|
||||
import {raw_message_schema} from "./message_store.ts";
|
||||
import * as message_util from "./message_util.ts";
|
||||
import * as message_viewport from "./message_viewport.ts";
|
||||
import * as narrow_banner from "./narrow_banner.ts";
|
||||
import {page_params} from "./page_params.ts";
|
||||
import * as people from "./people.ts";
|
||||
@@ -176,7 +177,7 @@ function process_result(data: MessageFetchResponse, opts: MessageFetchOptions):
|
||||
// the messages we requested, and all of them are in muted
|
||||
// topics, but there are older messages for this stream that
|
||||
// we need to ask the server for.
|
||||
message_lists.current.visibly_empty()
|
||||
(message_lists.current.visibly_empty() || !message_viewport.can_scroll())
|
||||
) {
|
||||
const looking_for_new_msgs = opts.num_after > 0;
|
||||
const looking_for_old_msgs = opts.num_before > 0;
|
||||
|
||||
@@ -542,6 +542,11 @@ export function maybe_scroll_to_selected(): void {
|
||||
}
|
||||
}
|
||||
|
||||
export function can_scroll(): boolean {
|
||||
const full_height = util.the($scroll_container).scrollHeight;
|
||||
return full_height > window.innerHeight;
|
||||
}
|
||||
|
||||
export function initialize(): void {
|
||||
// This handler must be placed before all resize handlers in our application
|
||||
$(window).on("resize", () => {
|
||||
|
||||
Reference in New Issue
Block a user