Extract message_fetch.load_messages_for_narrow().

This helps us consolidate the fetching constants without
having to export them.  It will also remove some
responsibility for narrow.js to track fetching state.
This commit is contained in:
Steve Howell
2018-03-09 09:32:28 -05:00
committed by Tim Abbott
parent 22162a02a8
commit ec305149be
2 changed files with 18 additions and 7 deletions

View File

@@ -6,6 +6,8 @@ var consts = {
backfill_idle_time: 10*1000,
error_retry_time: 5000,
backfill_batch_size: 1000,
narrow_before: 50,
narrow_after: 50,
num_before_pointer: 200,
num_after_pointer: 200,
backward_batch_size: 100,
@@ -129,6 +131,19 @@ exports.load_messages = function (opts) {
});
};
exports.load_messages_for_narrow = function (opts) {
message_fetch.load_messages({
anchor: opts.then_select_id.toFixed(),
num_before: consts.narrow_before,
num_after: consts.narrow_after,
msg_list: message_list.narrowed,
use_first_unread_anchor: opts.use_initial_narrow_pointer,
cont: function () {
exports.reset_for_new_narrow();
opts.cont();
},
});
};
exports.maybe_load_older_messages = function (opts) {
// This function gets called when you scroll to the top