diff --git a/web/src/message_fetch.js b/web/src/message_fetch.js index 91ff117a41..b31565bf33 100644 --- a/web/src/message_fetch.js +++ b/web/src/message_fetch.js @@ -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); } diff --git a/web/tests/message_fetch.test.js b/web/tests/message_fetch.test.js index ae2c55a841..7176ecfe16 100644 --- a/web/tests/message_fetch.test.js +++ b/web/tests/message_fetch.test.js @@ -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),