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,8 +907,9 @@ $(function () {
}
// catch the user up
if (messages.length !== 1) {
if (messages.length !== 0) {
var latest_id = messages[messages.length-1].id;
if (latest_id < page_params.max_message_id) {
load_old_messages({
anchor: latest_id,
num_before: 0,
@@ -918,6 +919,7 @@ $(function () {
});
return;
}
}
// now start subscribing to updates
get_updates();