From d8714ae3ff7e6b6f28819528486e84fb6dbca5a3 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 26 Sep 2012 13:57:19 -0400 Subject: [PATCH] Use switch/case in add_zephyr_metadata (imported from commit f5a2357a4359d3e16d22a0c561561c5f54b16538) --- zephyr/static/js/zephyr.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index ea850af36c..84516042dc 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -685,7 +685,8 @@ function add_to_table(zephyrs, table_name, filter_function) { function add_zephyr_metadata(dummy, zephyr) { last_received = Math.max(last_received, zephyr.id); - if (zephyr.type === 'class') { + switch (zephyr.type) { + case 'class': zephyr.is_class = true; if ($.inArray(zephyr.display_recipient, class_list) === -1) { class_list.push(zephyr.display_recipient); @@ -695,10 +696,14 @@ function add_zephyr_metadata(dummy, zephyr) { instance_list.push(zephyr.instance); update_autocomplete(); } - } else if (zephyr.type === "huddle") { + break; + + case 'huddle': zephyr.is_huddle = true; zephyr.reply_to = get_huddle_recipient(zephyr); - } else { + break; + + case 'personal': zephyr.is_personal = true; if (zephyr.display_recipient === email) { // that is, we sent the original message @@ -712,6 +717,7 @@ function add_zephyr_metadata(dummy, zephyr) { people_list.push(zephyr.reply_to); update_autocomplete(); } + break; } var time = new Date(zephyr.timestamp * 1000);