From 3fe1e554a6b34a5f94bbc0f5903ae1db7ac6ec42 Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Wed, 30 Oct 2024 18:56:22 +0530 Subject: [PATCH] echo: Fix send messages not visible when auto narrowed to recipient. We simply forgot to `add_to_narrow` locally echoed messages if the current narrow changed before we received confirmation from server. --- web/src/echo.ts | 1 + web/tests/echo.test.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/web/src/echo.ts b/web/src/echo.ts index 9d91a7e2ff..bcf4c0a2f4 100644 --- a/web/src/echo.ts +++ b/web/src/echo.ts @@ -557,6 +557,7 @@ export function process_from_server(messages: ServerMessage[]): ServerMessage[] // message content, but in practice, there's no harm to just // doing it unconditionally. msg_list.view.rerender_messages(msgs_to_rerender_or_add_to_narrow); + msg_list.add_messages(msgs_to_rerender_or_add_to_narrow, {}); } } } diff --git a/web/tests/echo.test.js b/web/tests/echo.test.js index ee91b04583..02c2f2dfaa 100644 --- a/web/tests/echo.test.js +++ b/web/tests/echo.test.js @@ -47,6 +47,7 @@ message_lists.current = { }, }, change_message_id: noop, + add_messages: noop, }; const home_msg_list = { view: { @@ -62,6 +63,7 @@ const home_msg_list = { }, preserver_rendered_state: true, change_message_id: noop, + add_messages: noop, }; message_lists.all_rendered_message_lists = () => [home_msg_list, message_lists.current]; message_lists.non_rendered_data = () => [];