mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 01:16:19 +00:00
message fetch: Pass narrow param for recent topics message list.
In commit ebea17b9a6,
we added an extra fetch to get accurate data for the top
items in recent topics table.
But the `narrow` parameter wasn't passed to the endpoint,
this resulted in fetching the user's overall message
history including the muted streams/topics which aren't
required by the recent topics table.
`operators` can be replaced as we set the same value for
the `narrow_state` module and the narrowed message list's
filter, when activating the narrow.
This commit is contained in:
@@ -296,14 +296,12 @@ run_test("initialize", () => {
|
||||
function simulate_narrow() {
|
||||
const filter = {
|
||||
predicate: () => () => false,
|
||||
public_operators: () => [{operator: "pm-with", operand: alice.email}],
|
||||
};
|
||||
|
||||
narrow_state.active = function () {
|
||||
return true;
|
||||
};
|
||||
narrow_state.public_operators = function () {
|
||||
return [{operator: "pm-with", operand: alice.email}];
|
||||
};
|
||||
|
||||
const msg_list = new message_list.MessageList({
|
||||
table_name: "zfilt",
|
||||
|
||||
@@ -178,8 +178,8 @@ exports.load_messages = function (opts) {
|
||||
}
|
||||
let data = {anchor: opts.anchor, num_before: opts.num_before, num_after: opts.num_after};
|
||||
|
||||
if (opts.msg_list.narrowed && narrow_state.active()) {
|
||||
let operators = narrow_state.public_operators();
|
||||
if ((opts.msg_list.narrowed && narrow_state.active()) || opts.force_fetch) {
|
||||
let operators = opts.msg_list.data.filter.public_operators();
|
||||
if (page_params.narrow !== undefined) {
|
||||
operators = operators.concat(page_params.narrow);
|
||||
}
|
||||
@@ -458,6 +458,7 @@ exports.initialize = function () {
|
||||
num_before: consts.recent_topics_initial_fetch_size,
|
||||
num_after: 0,
|
||||
msg_list: recent_topics_message_list,
|
||||
force_fetch: true,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user