Skip to content

Commit

Permalink
(js) Fix auto-completion of list members
Browse files Browse the repository at this point in the history
Fixes #3870
  • Loading branch information
cgx committed Oct 26, 2016
1 parent 1d09a98 commit 7310834
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion UI/Templates/ContactsUI/UIxContactEditorTemplate.wox
Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions UI/WebServerResources/js/Contacts/AddressBook.service.js
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
});
});
Expand Down
15 changes: 7 additions & 8 deletions UI/WebServerResources/js/Contacts/CardController.js
Expand Up @@ -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;

Expand Down Expand Up @@ -37,8 +37,6 @@
vm.toggleRawSource = toggleRawSource;
vm.showRawSource = false;

minSearchLength = angular.isNumber($window.minimumSearchLength)? $window.minimumSearchLength : 2;


_registerHotkeys(hotkeys);

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7310834

Please sign in to comment.