mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-01 01:39:30 +00:00
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:
@@ -424,6 +424,27 @@
|
||||
return this.refs.length - 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* @function explode
|
||||
* @memberof Card.prototype
|
||||
* @desc Create a new Card associated to each email address of this card.
|
||||
* @return an array of Card instances
|
||||
*/
|
||||
Card.prototype.explode = function() {
|
||||
var _this = this, cards = [], data;
|
||||
|
||||
if (this.emails.length > 1) {
|
||||
data = this.$omit();
|
||||
_.forEach(this.emails, function(email) {
|
||||
var card = new Card(angular.extend({}, data, {emails: [email]}));
|
||||
cards.push(card);
|
||||
});
|
||||
return cards;
|
||||
}
|
||||
else
|
||||
return [this];
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $reset
|
||||
* @memberof Card.prototype
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user