mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
message_fetch: Pass msg_list to load_messages_for_narrow.
This tweak makes the code easier to reason about and may also help generalize the codebase to support maintaining multiple message lists.
This commit is contained in:
@@ -169,10 +169,12 @@ run_test("basics", () => {
|
|||||||
let cont;
|
let cont;
|
||||||
|
|
||||||
message_fetch.load_messages_for_narrow = (opts) => {
|
message_fetch.load_messages_for_narrow = (opts) => {
|
||||||
|
// Only validates the anchor and set of fields
|
||||||
cont = opts.cont;
|
cont = opts.cont;
|
||||||
|
|
||||||
assert.deepEqual(opts, {
|
assert.deepEqual(opts, {
|
||||||
cont: opts.cont,
|
cont: opts.cont,
|
||||||
|
msg_list: opts.msg_list,
|
||||||
anchor: 1000,
|
anchor: 1000,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -292,13 +292,11 @@ export function load_messages(opts, attempt = 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function load_messages_for_narrow(opts) {
|
export function load_messages_for_narrow(opts) {
|
||||||
const msg_list = message_list.narrowed;
|
|
||||||
|
|
||||||
load_messages({
|
load_messages({
|
||||||
anchor: opts.anchor,
|
anchor: opts.anchor,
|
||||||
num_before: consts.narrow_before,
|
num_before: consts.narrow_before,
|
||||||
num_after: consts.narrow_after,
|
num_after: consts.narrow_after,
|
||||||
msg_list,
|
msg_list: opts.msg_list,
|
||||||
cont: opts.cont,
|
cont: opts.cont,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,6 +534,7 @@ export function activate(raw_operators, opts) {
|
|||||||
msg_list.network_time = new Date();
|
msg_list.network_time = new Date();
|
||||||
maybe_report_narrow_time(msg_list);
|
maybe_report_narrow_time(msg_list);
|
||||||
},
|
},
|
||||||
|
msg_list,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user