(js) Respect SearchMinWordLength in list editor

More precisely, the domain default is named SOGoSearchMinimumWordLength.
pull/225/head
Francis Lachapelle 2016-10-14 16:35:57 -04:00
parent 56283668d0
commit 3e501be5a9
3 changed files with 9 additions and 1 deletions

1
NEWS
View File

@ -8,6 +8,7 @@ Enhancements
Bug fixes
- [web] fixed tasks list when some weekdays are disabled
- [web] fixed automatic refresh of calendar view
- [web] respect SOGoSearchMinimumWordLength in contacts list editor
3.2.0 (2016-10-03)

View File

@ -372,7 +372,9 @@
<var:string label:value="Members"/>
</label>
<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

@ -9,7 +9,7 @@
*/
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 = [];
var vm = this, hotkeys = [], minSearchLength;
vm.card = stateCard;
@ -37,6 +37,8 @@
vm.toggleRawSource = toggleRawSource;
vm.showRawSource = false;
minSearchLength = angular.isNumber($window.minimumSearchLength)? $window.minimumSearchLength : 2;
_registerHotkeys(hotkeys);
@ -98,6 +100,9 @@
focus('address_' + i);
}
function userFilter($query, excludedCards) {
if ($query.length < minSearchLength)
return [];
AddressBook.selectedFolder.$filter($query, {dry: true, excludeLists: true}, excludedCards);
return AddressBook.selectedFolder.$$cards;
}