message_fetch: Check filter instead of message list.

Reduces use of `message_lists.home`.
This commit is contained in:
Aman Agrawal 2024-03-07 06:03:28 +00:00 committed by Tim Abbott
parent 1f6625168a
commit 374e09b2da
2 changed files with 8 additions and 1 deletions

View File

@ -251,7 +251,7 @@ export function load_messages(opts, attempt = 1) {
// But support for the all_messages_data sharing of data with
// message_lists.home and the (hacky) page_params.narrow feature
// requires a somewhat ugly bundle of conditionals.
if (opts.msg_list === message_lists.home) {
if (msg_list_data.filter.is_in_home()) {
if (page_params.narrow_stream !== undefined) {
data.narrow = JSON.stringify(page_params.narrow);
}

View File

@ -148,6 +148,8 @@ const initialize_data = {
num_before: 200,
num_after: 200,
client_gravatar: true,
// Same as message_lists.home.data.public_terms() after `reset_lists` is called.
narrow: JSON.stringify([]),
},
resp: {
messages: message_range(201, 801),
@ -162,6 +164,7 @@ const initialize_data = {
num_before: 0,
num_after: 1000,
client_gravatar: true,
narrow: JSON.stringify([]),
},
resp: {
messages: message_range(800, 1000),
@ -175,6 +178,7 @@ const initialize_data = {
num_before: 1000,
num_after: 0,
client_gravatar: true,
narrow: JSON.stringify([]),
},
resp: {
messages: message_range(100, 200),
@ -422,6 +426,7 @@ run_test("loading_newer", () => {
num_before: 0,
num_after: 100,
client_gravatar: true,
narrow: JSON.stringify([]),
},
resp: {
messages: message_range(500, 600),
@ -443,6 +448,7 @@ run_test("loading_newer", () => {
num_before: 0,
num_after: 100,
client_gravatar: true,
narrow: JSON.stringify([]),
},
resp: {
messages: message_range(500, 600),
@ -455,6 +461,7 @@ run_test("loading_newer", () => {
num_before: 0,
num_after: 100,
client_gravatar: true,
narrow: JSON.stringify([]),
},
resp: {
messages: message_range(700, 800),