From bec1b55930a49e4e9eac81ec5892a2a962ad40cf Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 26 Sep 2012 13:59:25 -0400 Subject: [PATCH] Use switch/case in respond_to_zephyr (imported from commit 4afef9103075a00772f3c0e29d634a28cb5d5b5a) --- zephyr/static/js/zephyr.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 84516042dc..8eb5a5589f 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -359,15 +359,20 @@ function respond_to_zephyr() { var zephyr, recipient, recipients; zephyr = zephyr_dict[selected_zephyr_id]; - if (zephyr.type === 'class') { + switch (zephyr.type) { + case 'class': $('#zephyr-type-tabs a[href="#class-message"]').tab('show'); $("#class").val(zephyr.display_recipient); $("#instance").val(zephyr.instance); show_compose('class', $("#new_zephyr")); - } else if (zephyr.type === 'huddle') { + break; + + case 'huddle': $('#zephyr-type-tabs a[href="#personal-message"]').tab('show'); prepare_huddle(zephyr.reply_to); - } else if (zephyr.type === 'personal') { + break; + + case 'personal': // Until we allow sending zephyrs based on multiple meaningful // representations of a user (name, username, email, etc.), just // deal with emails. @@ -376,9 +381,8 @@ function respond_to_zephyr() { recipient = zephyr.sender_email; } prepare_huddle(recipient); + break; } - - } // Called by mouseover etc.