mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
message_fetch: Extract do_backfill().
This slightly changes the order of operations of what we do in the `cont` callback, so that we update fetch status earlier. The order is somewhat arbitrary here, but we generally want to update data structures first.
This commit is contained in:
@@ -173,22 +173,36 @@ exports.maybe_load_older_messages = function (opts) {
|
||||
// got the oldest one.
|
||||
return;
|
||||
}
|
||||
|
||||
opts.show_loading();
|
||||
exports.do_backfill({
|
||||
msg_list: msg_list,
|
||||
num_before: consts.backward_batch_size,
|
||||
cont: function () {
|
||||
opts.hide_loading();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
exports.do_backfill = function (opts) {
|
||||
var msg_list = opts.msg_list;
|
||||
|
||||
msg_list.fetch_status.start_older_batch();
|
||||
|
||||
var anchor = exports.get_backfill_anchor(msg_list).toFixed();
|
||||
var batch_size = consts.backward_batch_size;
|
||||
|
||||
exports.load_messages({
|
||||
anchor: anchor,
|
||||
num_before: batch_size,
|
||||
num_before: opts.num_before,
|
||||
num_after: 0,
|
||||
msg_list: msg_list,
|
||||
cont: function (data) {
|
||||
opts.hide_loading();
|
||||
msg_list.fetch_status.finish_older_batch({
|
||||
found_oldest: data.found_oldest,
|
||||
});
|
||||
if (opts.cont) {
|
||||
opts.cont();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user