Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_view: Accept message list data fetch status.
Shubham Padia46c416664291
diff --git a/web/src/message_view.ts b/web/src/message_view.tsindex 9982fae81d8..73dff7f35ec 100644--- a/web/src/message_view.ts+++ b/web/src/message_view.ts@@ -18,7 +18,6 @@ import * as compose_recipient from "./compose_recipient.ts";import * as compose_state from "./compose_state.ts";import * as condense from "./condense.ts";import * as feedback_widget from "./feedback_widget.ts";-import type {FetchStatus} from "./fetch_status.ts";import {Filter} from "./filter.ts";import * as hash_parser from "./hash_parser.ts";import * as hash_util from "./hash_util.ts";@@ -936,11 +935,10 @@ export function rewire_show(value: typeof show): void {function navigate_to_anchor_message(opts: {anchor: string;- fetch_status_shows_anchor_fetched: (fetch_status: FetchStatus) => boolean;+ is_anchor_fetched: (data: MessageListData) => boolean;message_list_data_to_target_message_id: (data: MessageListData) => number;}): void {- const {anchor, fetch_status_shows_anchor_fetched, message_list_data_to_target_message_id} =- opts;+ const {anchor, is_anchor_fetched, message_list_data_to_target_message_id} = opts;// The function navigates user to the anchor in the current// message list. We don't use `message_view.show` here due// to following reasons:@@ -982,10 +980,10 @@ function navigate_to_anchor_message(opts: {}assert(message_lists.current !== undefined);- if (fetch_status_shows_anchor_fetched(message_lists.current.data.fetch_status)) {+ if (is_anchor_fetched(message_lists.current.data)) {select_msg_id(message_list_data_to_target_message_id(message_lists.current.data));return;- } else if (fetch_status_shows_anchor_fetched(all_messages_data.fetch_status)) {+ } else if (is_anchor_fetched(all_messages_data)) {// We can load messages into `msg_list_data` but we don't know// the fetch status until we contact server. If we are contacting the// server, it is better to just fetch the required messages instead@@ -1032,8 +1030,8 @@ export function fast_track_current_msg_list_to_anchor(anchor: string): void {if (anchor === "oldest") {navigate_to_anchor_message({anchor,- fetch_status_shows_anchor_fetched(fetch_status) {- return fetch_status.has_found_oldest();+ is_anchor_fetched(msg_list_data) {+ return msg_list_data.fetch_status.has_found_oldest();},message_list_data_to_target_message_id(msg_list_data) {return msg_list_data.first()!.id;@@ -1042,8 +1040,8 @@ export function fast_track_current_msg_list_to_anchor(anchor: string): void {} else if (anchor === "newest") {navigate_to_anchor_message({anchor,- fetch_status_shows_anchor_fetched(fetch_status) {- return fetch_status.has_found_newest();+ is_anchor_fetched(msg_list_data) {+ return msg_list_data.fetch_status.has_found_newest();},message_list_data_to_target_message_id(msg_list_data) {return msg_list_data.last()!.id;