From 899d5c776f4d7b732ab698b4b4e01398a792ff73 Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Mon, 22 Oct 2012 18:18:15 -0400 Subject: [PATCH] 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) --- zephyr/static/js/zephyr.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 3ebd398cc7..7264a55076 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -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); }