message_view: Notify user when the local first unread was incorrect.

Fixes #33570

When navigating to a narrow based on locally available unread
data with `old_unreads_missing`, we verify the calculated
first unread message id with server and if there is an unread message
prior to the one we calculated locally, we convert the current
narrow into a `near` narrow and show a banner with a button to
allow user to navigate to the correct first unread message.
This commit is contained in:
Aman Agrawal
2025-03-12 10:20:29 +00:00
committed by Tim Abbott
parent f1e6371bf8
commit bf508ce638
4 changed files with 127 additions and 7 deletions

View File

@@ -29,7 +29,7 @@ import * as stream_data from "./stream_data.ts";
import * as stream_list from "./stream_list.ts";
import * as util from "./util.ts";
const response_schema = z.object({
export const response_schema = z.object({
anchor: z.number(),
found_newest: z.boolean(),
found_oldest: z.boolean(),
@@ -341,7 +341,9 @@ export function get_narrow_for_message_fetch(filter: Filter): string {
return narrow_param_string;
}
function get_parameters_for_message_fetch_api(opts: MessageFetchOptions): MessageFetchAPIParams {
export function get_parameters_for_message_fetch_api(
opts: MessageFetchOptions,
): MessageFetchAPIParams {
if (typeof opts.anchor === "number") {
// Messages that have been locally echoed messages have
// floating point temporary IDs, which is intended to be a.