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:
Tim Abbott
2013-04-23 13:53:11 -04:00
parent 9b8f0fab0f
commit 1c57956bf6

View File

@@ -907,16 +907,18 @@ $(function () {
} }
// catch the user up // catch the user up
if (messages.length !== 1) { if (messages.length !== 0) {
var latest_id = messages[messages.length-1].id; var latest_id = messages[messages.length-1].id;
load_old_messages({ if (latest_id < page_params.max_message_id) {
anchor: latest_id, load_old_messages({
num_before: 0, anchor: latest_id,
num_after: 400, num_before: 0,
msg_list: home_msg_list, num_after: 400,
cont: load_more msg_list: home_msg_list,
}); cont: load_more
return; });
return;
}
} }
// now start subscribing to updates // now start subscribing to updates
get_updates(); get_updates();