mirror of
https://github.com/zulip/zulip.git
synced 2026-06-21 21:32:29 +08:00
message_fetch: Deduplicate logic for start_older_batch.
We were doing this work individually in all the callers of load_messages; better is to just do it in one place.
This commit is contained in:
parent
9ccb3a2ad1
commit
7febf724f3
@ -42,6 +42,7 @@ run_test('basics', () => {
|
||||
reset();
|
||||
|
||||
fetch_status.start_initial_narrow();
|
||||
fetch_status.start_older_batch();
|
||||
|
||||
blocked_newer();
|
||||
blocked_older();
|
||||
@ -64,6 +65,7 @@ run_test('basics', () => {
|
||||
reset();
|
||||
|
||||
fetch_status.start_initial_narrow();
|
||||
fetch_status.start_older_batch();
|
||||
|
||||
blocked_newer();
|
||||
blocked_older();
|
||||
|
||||
@ -10,7 +10,6 @@ var FetchStatus = function () {
|
||||
|
||||
self.start_initial_narrow = function () {
|
||||
loading_newer = true;
|
||||
loading_older = true;
|
||||
};
|
||||
|
||||
self.finish_initial_narrow = function (opts) {
|
||||
|
||||
@ -112,6 +112,13 @@ exports.load_messages = function (opts) {
|
||||
data.use_first_unread_anchor = true;
|
||||
}
|
||||
|
||||
if (opts.num_before > 0) {
|
||||
opts.msg_list.fetch_status.start_older_batch();
|
||||
if (opts.msg_list === home_msg_list) {
|
||||
message_list.all.fetch_status.start_older_batch();
|
||||
}
|
||||
}
|
||||
|
||||
data.client_gravatar = true;
|
||||
|
||||
channel.get({
|
||||
@ -223,12 +230,6 @@ exports.maybe_load_older_messages = function (opts) {
|
||||
|
||||
exports.do_backfill = function (opts) {
|
||||
var msg_list = opts.msg_list;
|
||||
|
||||
msg_list.fetch_status.start_older_batch();
|
||||
if (msg_list === home_msg_list) {
|
||||
message_list.all.fetch_status.start_older_batch();
|
||||
}
|
||||
|
||||
var anchor = exports.get_backfill_anchor(msg_list).toFixed();
|
||||
|
||||
exports.load_messages({
|
||||
@ -340,8 +341,6 @@ exports.initialize = function () {
|
||||
if (page_params.have_initial_messages) {
|
||||
home_msg_list.fetch_status.start_newer_batch();
|
||||
message_list.all.fetch_status.start_newer_batch();
|
||||
home_msg_list.fetch_status.start_older_batch();
|
||||
message_list.all.fetch_status.start_older_batch();
|
||||
exports.load_messages({
|
||||
anchor: page_params.pointer,
|
||||
num_before: consts.num_before_pointer,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user