summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-24 14:54:18 +0200
committerAleksander Machniak <alec@alec.pl>2013-05-24 14:54:18 +0200
commit1dfa85e0e673fef4976895b24c6497893dadd413 (patch)
treed18d9465876d57cc8aa0371953179feed869550a /program/js
parentab845c07186e347cfa9093a3080575fbe8864053 (diff)
Fix handling of comma when adding contact from contacts widget (#1489107)
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 40acbe60f..101be65a3 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3083,7 +3083,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++) {
@@ -3102,8 +3102,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 });
}
};