Don't expand groups without id

Skipping redundant request for cases like ACL plugin where we may deal
with groups that may have no mail, id nor source assigned in acl identifier
autocompletion.
pull/6811/head
Aleksander Machniak 6 years ago
parent 0a0ad2c9b7
commit 7846505fa4

@ -5794,29 +5794,30 @@ function rcube_webmail()
if (id === null || !this.env.contacts[id] || !this.ksearch_input)
return;
var trigger = false, insert = '', delim = ', ';
var trigger = false, insert = '', delim = ', ',
contact = this.env.contacts[id];
this.ksearch_destroy();
// insert all members of a group
if (typeof this.env.contacts[id] === 'object' && this.env.contacts[id].type == 'group' && !this.env.contacts[id].email) {
insert += this.env.contacts[id].name + delim;
this.group2expand[this.env.contacts[id].id] = $.extend({ input: this.ksearch_input }, this.env.contacts[id]);
this.http_request('mail/group-expand', {_source: this.env.contacts[id].source, _gid: this.env.contacts[id].id}, false);
if (typeof contact === 'object' && contact.type == 'group' && !contact.email && contact.id) {
insert = contact.name + delim;
this.group2expand[contact.id] = $.extend({input: this.ksearch_input}, contact);
this.http_request('mail/group-expand', {_source: contact.source, _gid: contact.id}, false);
}
else if (typeof this.env.contacts[id] === 'object' && this.env.contacts[id].name) {
insert = this.env.contacts[id].name + delim;
else if (typeof contact === 'object' && contact.name) {
insert = contact.name + delim;
trigger = true;
}
else if (typeof this.env.contacts[id] === 'string') {
insert = this.env.contacts[id] + delim;
else if (typeof contact === 'string') {
insert = contact + delim;
trigger = true;
}
this.ksearch_input_replace(this.ksearch_value, insert);
if (trigger) {
this.triggerEvent('autocomplete_insert', { field:this.ksearch_input, insert:insert, data:this.env.contacts[id], search:this.ksearch_value_last, result_type:'person' });
this.triggerEvent('autocomplete_insert', {field: this.ksearch_input, insert: insert, data: contact, search: this.ksearch_value_last, result_type: 'person'});
this.ksearch_value_last = null;
this.compose_type_activity++;
}

Loading…
Cancel
Save