From dbb0241568ba2e9ddfbc96e41dbfc739a01d193a Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Tue, 20 Nov 2012 14:06:36 -0500 Subject: [PATCH] add_to_table: bail early if there are no messages to render This bug affected receiving messages while narrowed. When none of the messages recieved matched the narrow predicate, we'd try to render messages and then create a jQuery object out of a bunch of newlines (the only thing that results from a render of 0 messages). (imported from commit 81f5aa46fac06fe0e5a14a8757f245f90b5845cc) --- zephyr/static/js/zephyr.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 5586ce024d..4f80a44ab5 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -335,6 +335,10 @@ function add_to_table(messages, table_name, filter_function, where, allow_collap prev = message; }); + if (messages_to_render.length === 0) { + return; + } + if (current_group.length > 0) new_message_groups.push(current_group);