message_list: Don't always cache "Combined feed" view.

Important changes in this commit:
* We only cache message list for "Combined feed" if it is the
  default view.

* We modify existing handling of home message list code so that
  it can be used to for any message list that we want to cache
  using a new `preserve_rendered_state` variable.

* narrow_state.filter() returns the filter of combined feed view  list
  instead of `undefined`.

* We start fetching messages from the latest message on app load.

* Messages in all messages data and Recent view are always synced.

* If combined feed view list is not cached, we don't track it's
  last pointer, effectively sending user to the latest unread
  message always .
This commit is contained in:
Aman Agrawal
2024-04-21 03:31:35 +00:00
committed by Tim Abbott
parent 2ccbb9bc00
commit 103c37f23a
31 changed files with 183 additions and 850 deletions

View File

@@ -11,6 +11,12 @@ async function get_stream_li(page: Page, stream_name: string): Promise<string> {
async function expect_home(page: Page): Promise<void> {
const message_list_id = await common.get_current_msg_list_id(page, true);
await page.waitForSelector(`.message-list[data-message-list-id='${message_list_id}']`, {
visible: true,
});
// Assert that there is only one message list.
assert.equal((await page.$$(".message-list")).length, 1);
assert.strictEqual(await page.title(), "Combined feed - Zulip Dev - Zulip");
await common.check_messages_sent(page, message_list_id, [
["Verona > test", ["verona test a", "verona test b"]],
["Verona > other topic", ["verona other topic c"]],
@@ -107,10 +113,6 @@ async function un_narrow(page: Page): Promise<void> {
await page.keyboard.press("Escape");
}
await page.click("#left-sidebar-navigation-list .top_left_all_messages");
await page.waitForSelector(".message-list .message_row", {visible: true});
// Assert that there is only one message list.
assert.equal((await page.$$(".message-list")).length, 1);
assert.strictEqual(await page.title(), "Combined feed - Zulip Dev - Zulip");
}
async function un_narrow_by_clicking_org_icon(page: Page): Promise<void> {
@@ -322,6 +324,7 @@ async function test_narrow_by_clicking_the_left_sidebar(page: Page): Promise<voi
await expect_all_direct_messages(page);
await un_narrow(page);
await expect_home(page);
}
async function arrow(page: Page, direction: "Up" | "Down"): Promise<void> {