Iterate through an array without using 'in', remove extra spacing.

This corrects some additional bugs introduced in 9128ddd and a5f06bd
identified by Keegan.

We previously used "for i in"-style looping, which is sub-optimal. Move
to a different style.

We also had a weird spacing thing I introduced in a previous commit,
which has now been fixed.

(imported from commit 7334d8ee703564bedeb0ea939b0d64ad2d5fceba)
This commit is contained in:
Luke Faraone
2012-09-17 13:02:41 -04:00
parent de5ff99c21
commit 8a89c56b7b

View File

@@ -228,7 +228,7 @@ function respond_to_zephyr() {
} else if (zephyr.type === 'huddle') { } else if (zephyr.type === 'huddle') {
$('#zephyr-type-tabs a[href="#personal-message"]').tab('show'); $('#zephyr-type-tabs a[href="#personal-message"]').tab('show');
recipient = ''; recipient = '';
for (i in zephyr.display_recipient) { for (var i = 0; i < zephyr.display_recipient.length; i++) {
recipient += zephyr.display_recipient[i].name + ', '; recipient += zephyr.display_recipient[i].name + ', ';
} }
prepare_huddle(recipient); prepare_huddle(recipient);
@@ -237,7 +237,7 @@ function respond_to_zephyr() {
// representations of a user (name, username, email, etc.), just // representations of a user (name, username, email, etc.), just
// deal with usernames. // deal with usernames.
recipient = zephyr.display_recipient; recipient = zephyr.display_recipient;
if ( recipient === username) { // that is, we sent the original message if (recipient === username) { // that is, we sent the original message
recipient = zephyr.sender; recipient = zephyr.sender;
} }
prepare_huddle(recipient); prepare_huddle(recipient);