Expose all email addresses in autocompletion

This change is immediately applicable to LDAP-based system address
books. However, personal SQL-based address books must have their quick
tables recreated. To do so, one must use sogo-tool to backup and restore
the user's data.

Resolves #3443, #3526
This commit is contained in:
Francis Lachapelle
2016-05-25 10:25:53 -04:00
parent 6dc80e1159
commit fd4b09428f
6 changed files with 103 additions and 28 deletions

View File

@@ -197,8 +197,20 @@
}
function contactFilter($query) {
AddressBook.$filterAll($query);
return AddressBook.$cards;
return AddressBook.$filterAll($query).then(function(cards) {
// Divide the matching cards by email addresses so the user can select
// the recipient address of her choice
var explodedCards = [];
_.forEach(_.invokeMap(cards, 'explode'), function(manyCards) {
_.forEach(manyCards, function(card) {
explodedCards.push(card);
});
});
// Remove duplicates
return _.uniqBy(explodedCards, function(card) {
return card.$$fullname + ' ' + card.$$email;
});
});
}
function addRecipient(contact, field) {