Skip to content

Commit

Permalink
(js) Add minimumSearchLength to sgSettings value
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Oct 26, 2016
1 parent b44bf86 commit 1d09a98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions UI/WebServerResources/js/Common/Common.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
return settings[param];
else
return settings;
},
minimumSearchLength: function() {
return angular.isNumber(minimumSearchLength)? minimumSearchLength : 2;
}
})

Expand Down
7 changes: 5 additions & 2 deletions UI/WebServerResources/js/Preferences/PreferencesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/**
* @ngInject
*/
PreferencesController.$inject = ['$q', '$window', '$state', '$mdMedia', '$mdSidenav', '$mdDialog', '$mdToast', 'sgFocus', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication'];
function PreferencesController($q, $window, $state, $mdMedia, $mdSidenav, $mdDialog, $mdToast, focus, Dialog, User, Account, statePreferences, Authentication) {
PreferencesController.$inject = ['$q', '$window', '$state', '$mdMedia', '$mdSidenav', '$mdDialog', '$mdToast', 'sgSettings', 'sgFocus', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication'];
function PreferencesController($q, $window, $state, $mdMedia, $mdSidenav, $mdDialog, $mdToast, sgSettings, focus, Dialog, User, Account, statePreferences, Authentication) {
var vm = this, account, mailboxes = [], today = new Date(), tomorrow = today.beginOfDay().addDays(1);

vm.preferences = statePreferences;
Expand Down Expand Up @@ -244,6 +244,9 @@
}

function userFilter(search, excludedUsers) {
if (search.length < sgSettings.minimumSearchLength())
return [];

return User.$filter(search, excludedUsers).then(function(users) {
// Set users avatars
_.forEach(users, function(user) {
Expand Down

0 comments on commit 1d09a98

Please sign in to comment.