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:
Ryan Rehman
2020-11-20 18:31:12 +05:30
committed by Tim Abbott
parent 16c78e4b34
commit ec3df8cb4f
2 changed files with 4 additions and 5 deletions

View File

@@ -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,
});
};