mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
Avoid an unnecessary load_old_messages call on page load.
Previously, our check for whether we needed to call load_old_messages a second time on page load to get up to the present caused us to basically always do such a call. (imported from commit b599041e8c0853b4c8c9ab2def6679142302523e)
This commit is contained in:
@@ -907,16 +907,18 @@ $(function () {
|
||||
}
|
||||
|
||||
// catch the user up
|
||||
if (messages.length !== 1) {
|
||||
if (messages.length !== 0) {
|
||||
var latest_id = messages[messages.length-1].id;
|
||||
load_old_messages({
|
||||
anchor: latest_id,
|
||||
num_before: 0,
|
||||
num_after: 400,
|
||||
msg_list: home_msg_list,
|
||||
cont: load_more
|
||||
});
|
||||
return;
|
||||
if (latest_id < page_params.max_message_id) {
|
||||
load_old_messages({
|
||||
anchor: latest_id,
|
||||
num_before: 0,
|
||||
num_after: 400,
|
||||
msg_list: home_msg_list,
|
||||
cont: load_more
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
// now start subscribing to updates
|
||||
get_updates();
|
||||
|
||||
Reference in New Issue
Block a user