diff options
-rw-r--r-- | web-ui/app/js/mail_view/ui/recipients/recipients.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients.js b/web-ui/app/js/mail_view/ui/recipients/recipients.js index 3dfd6661..966f4ba8 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipients.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipients.js @@ -58,7 +58,7 @@ define( this.attr.iterator = null; var mailAddr = recipient.getMailAddress(); - var position = recipient.$node.closest('.recipients-area').find('.fixed-recipient').index(recipient.$node); + var position = this.getRecipientPosition(recipient); this.attr.recipients.splice(position, 1); recipient.destroy(); @@ -67,6 +67,10 @@ define( this.attr.input.$node.val(mailAddr).focus(); }; + this.getRecipientPosition = function(recipient) { + return recipient.$node.closest('.recipients-area').find('.fixed-recipient').index(recipient.$node); + } + this.unselectAllRecipients = function() { this.$node.find('.recipient-value.selected').removeClass('selected'); } @@ -96,14 +100,13 @@ define( }; this.deleteRecipient = function (event, recipient) { - var iter = new Iterator(this.attr.recipients, /*startingIndex=*/-1); + this.attr.iterator = null; + var position = this.getRecipientPosition(recipient); - while(iter.hasNext() && iter.next()) { - if (iter.current().isSelected() && iter.current().address === recipient.address) { - iter.removeCurrent().destroy(); - break; - } - } + this.attr.recipients.splice(position, 1); + recipient.destroy(); + + this.addressesUpdated(); }; this.deleteLastRecipient = function () { |