Check reason_empty on client when there are no new messages

This fixes a problem where the client would never stop asking for old
messages (bug introduced during rebase)

(imported from commit eef9f19e1e9982b1e0a954eb36a81e1b7ee5b564)
This commit is contained in:
Zev Benjamin 2012-10-22 18:18:15 -04:00
parent 2374b6e16f
commit 899d5c776f

View File

@ -495,16 +495,6 @@ function add_messages(data) {
$('#load_more').show();
}
if (data.messages.length === 0) {
if (data.reason_empty === 'no_old_messages') {
$('#load_more').hide();
// Don't ask for more old messages in the future.
max_messages_for_backfill = 0;
}
return;
}
$.each(data.messages, add_message_metadata);
if (data.where === 'top') {
@ -663,7 +653,14 @@ function get_updates() {
start_reload_app();
}
if (data.messages.length !== 0) {
if (data.messages.length === 0) {
if (data.reason_empty === 'no_old_messages') {
$('#load_more').hide();
// Don't ask for more old messages in the future.
max_messages_for_backfill = 0;
}
} else {
add_messages(data);
}