From 40d1f99cb2cb12631e2456bf4b5785500f599ffa Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 24 May 2013 14:54:18 +0200 Subject: Fix handling of comma when adding contact from contacts widget (#1489107) --- CHANGELOG | 1 + program/js/app.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f6ae96300..c5c54da84 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix handling of comma when adding contact from contacts widget (#1489107) - Fix bug where a message was opened in both preview pane and new window on double-click (#1489122) - Fix fatal error when xdebug.max_nesting_level was exceeded in rcube_washtml (#1489110) - Fix PHP warning in html_table::set_row_attribs() in PHP 5.4 (#1489094) diff --git a/program/js/app.js b/program/js/app.js index 7bdd98a61..d58a8f4fa 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3129,7 +3129,7 @@ function rcube_webmail() this.compose_add_recipient = function(field) { - var recipients = [], input = $('#_'+field); + var recipients = [], input = $('#_'+field), delim = this.env.recipients_delimiter; if (this.contact_list && this.contact_list.selection.length) { for (var id, n=0; n < this.contact_list.selection.length; n++) { @@ -3148,8 +3148,10 @@ function rcube_webmail() } if (recipients.length && input.length) { - var oldval = input.val(); - input.val((oldval ? oldval + this.env.recipients_delimiter : '') + recipients.join(this.env.recipients_delimiter)); + var oldval = input.val(), rx = new RegExp(RegExp.escape(delim) + '\\s*$'); + if (oldval && !rx.test(oldval)) + oldval += delim + ' '; + input.val(oldval + recipients.join(delim + ' ') + delim + ' '); this.triggerEvent('add-recipient', { field:field, recipients:recipients }); } }; -- cgit v1.2.3