(js) Fix auto-completion of list members

Fixes #3870
pull/225/head
Francis Lachapelle 2016-10-26 15:48:40 -04:00
parent 1d09a980da
commit 7310834ac6
4 changed files with 10 additions and 12 deletions

1
NEWS
View File

@ -17,6 +17,7 @@ Bug fixes
- [web] fixed saving the note of a card (#3849)
- [web] fixed support for recurrent tasks
- [web] improved validation of mail account delegators
- [web] fixed auto-completion of list members (#3870)
- [eas] improve handling of email folders without a parent
- [eas] never send IMIP reply when the "initiator" is Outlook 2013/2016
- [core] only consider SMTP addresses for AD's proxyAddresses (#3842)

View File

@ -375,7 +375,6 @@
<md-contact-chips
class="sg-chips-autocomplete"
ng-model="editor.card.refs"
ng-model-options="{ debounce: { default: 500 } }"
md-contacts="editor.userFilter($query, editor.card.refs)"
md-contact-name="$$fullname"
md-contact-image="$$image"

View File

@ -481,7 +481,7 @@
var futureData = AddressBook.$$resource.fetch(addressbookId, 'view', query);
if (dry) {
futureData.then(function(response) {
return futureData.then(function(response) {
var results, headers, card, index, fields, idFieldIndex,
cards = _this.$$cards,
compareIds = function(card) {
@ -539,13 +539,12 @@
}
});
_this.$isLoading = false;
return cards;
});
}
else {
// Unwrap promise and instantiate or extend Cards objets
_this.$unwrap(futureData);
return _this.$unwrap(futureData);
}
});
});

View File

@ -7,9 +7,9 @@
* Controller to view and edit a card
* @ngInject
*/
CardController.$inject = ['$scope', '$timeout', '$window', '$mdDialog', 'AddressBook', 'Card', 'Dialog', 'sgHotkeys', 'sgFocus', '$state', '$stateParams', 'stateCard'];
function CardController($scope, $timeout, $window, $mdDialog, AddressBook, Card, Dialog, sgHotkeys, focus, $state, $stateParams, stateCard) {
var vm = this, hotkeys = [], minSearchLength;
CardController.$inject = ['$scope', '$timeout', '$window', '$mdDialog', 'sgSettings', 'AddressBook', 'Card', 'Dialog', 'sgHotkeys', 'sgFocus', '$state', '$stateParams', 'stateCard'];
function CardController($scope, $timeout, $window, $mdDialog, sgSettings, AddressBook, Card, Dialog, sgHotkeys, focus, $state, $stateParams, stateCard) {
var vm = this, hotkeys = [];
vm.card = stateCard;
@ -37,8 +37,6 @@
vm.toggleRawSource = toggleRawSource;
vm.showRawSource = false;
minSearchLength = angular.isNumber($window.minimumSearchLength)? $window.minimumSearchLength : 2;
_registerHotkeys(hotkeys);
@ -100,11 +98,12 @@
focus('address_' + i);
}
function userFilter($query, excludedCards) {
if ($query.length < minSearchLength)
if ($query.length < sgSettings.minimumSearchLength())
return [];
AddressBook.selectedFolder.$filter($query, {dry: true, excludeLists: true}, excludedCards);
return AddressBook.selectedFolder.$$cards;
return AddressBook.selectedFolder.$filter($query, {dry: true, excludeLists: true}, excludedCards).then(function(cards) {
return cards;
});
}
function save(form) {
if (form.$valid) {