Browse Source

Fix handling of group names with @ character in autocomplete and contacts widget #8098 (#8101)

pull/8139/head
johndoh 4 years ago
committed by GitHub
parent
commit
5cc4021670
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      program/js/app.js
  2. 7
      skins/elastic/ui.js

8
program/js/app.js

@ -4883,7 +4883,7 @@ function rcube_webmail()
recipients.push(name);
// group is added, expand it
if (id.charAt(0) == 'E' && name.indexOf('@') < 0 && input.length) {
if (id.charAt(0) == 'E' && input.length) {
var gid = id.substr(1);
this.group2expand[gid] = {name: name, input: input.get(0)};
this.http_request('group-expand', {_source: data.source || this.env.source, _gid: gid}, false);
@ -5958,7 +5958,7 @@ function rcube_webmail()
trigger = true;
}
this.ksearch_input_replace(this.ksearch_value, insert);
this.ksearch_input_replace(this.ksearch_value, insert, null, trigger);
if (trigger) {
this.triggerEvent('autocomplete_insert', {field: this.ksearch_input, insert: insert, data: contact, search: this.ksearch_value_last, result_type: 'person'});
@ -6165,7 +6165,7 @@ function rcube_webmail()
// Setter for input value
// replaces 'from' string with 'to' and sets cursor position at the end
this.ksearch_input_replace = function(from, to, input)
this.ksearch_input_replace = function(from, to, input, trigger)
{
if (!this.ksearch_input && !input)
return;
@ -6184,7 +6184,7 @@ function rcube_webmail()
this.set_caret_pos(input, cpos + to.length - from.length);
// run onchange action on the element
$(input).trigger('change', [true]);
$(input).trigger('change', [true, trigger]);
};
this.ksearch_click = function(node)

7
skins/elastic/ui.js

@ -3223,9 +3223,14 @@ function rcube_elastic_ui()
return result.recipients.length > 0;
},
parse_func = function(e, ac) {
parse_func = function(e, ac, trigger) {
var last, paste, value = this.value;
// #8098: ignore changes when autocomplete_insert is not triggered
if (trigger === false) {
return;
}
// On paste the text is not yet in the input we have to use clipboard.
// Also because on paste new-line characters are replaced by spaces (#6460)
if (e.type == 'paste') {

Loading…
Cancel
Save