mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +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() {
|
function simulate_narrow() {
|
||||||
const filter = {
|
const filter = {
|
||||||
predicate: () => () => false,
|
predicate: () => () => false,
|
||||||
|
public_operators: () => [{operator: "pm-with", operand: alice.email}],
|
||||||
};
|
};
|
||||||
|
|
||||||
narrow_state.active = function () {
|
narrow_state.active = function () {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
narrow_state.public_operators = function () {
|
|
||||||
return [{operator: "pm-with", operand: alice.email}];
|
|
||||||
};
|
|
||||||
|
|
||||||
const msg_list = new message_list.MessageList({
|
const msg_list = new message_list.MessageList({
|
||||||
table_name: "zfilt",
|
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};
|
let data = {anchor: opts.anchor, num_before: opts.num_before, num_after: opts.num_after};
|
||||||
|
|
||||||
if (opts.msg_list.narrowed && narrow_state.active()) {
|
if ((opts.msg_list.narrowed && narrow_state.active()) || opts.force_fetch) {
|
||||||
let operators = narrow_state.public_operators();
|
let operators = opts.msg_list.data.filter.public_operators();
|
||||||
if (page_params.narrow !== undefined) {
|
if (page_params.narrow !== undefined) {
|
||||||
operators = operators.concat(page_params.narrow);
|
operators = operators.concat(page_params.narrow);
|
||||||
}
|
}
|
||||||
@@ -458,6 +458,7 @@ exports.initialize = function () {
|
|||||||
num_before: consts.recent_topics_initial_fetch_size,
|
num_before: consts.recent_topics_initial_fetch_size,
|
||||||
num_after: 0,
|
num_after: 0,
|
||||||
msg_list: recent_topics_message_list,
|
msg_list: recent_topics_message_list,
|
||||||
|
force_fetch: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user