fix check for more users

after a refactor users et al were undefined. The check condition was moved.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2018-09-03 17:18:00 +02:00
parent 210b0f092f
commit e7b0f8b001
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
1 changed files with 19 additions and 6 deletions

View File

@ -326,7 +326,23 @@
var suggestions = exactMatches.concat(users).concat(groups).concat(remotes).concat(remoteGroups).concat(emails).concat(circles).concat(rooms).concat(lookup);
deferred.resolve(suggestions, exactMatches);
var moreResultsAvailable =
(
oc_config['sharing.maxAutocompleteResults'] > 0
&& Math.min(perPage, oc_config['sharing.maxAutocompleteResults'])
<= Math.max(
users.length + exactUsers.length,
groups.length + exactGroups.length,
remoteGroups.length + exactRemoteGroups.length,
remotes.length + exactRemotes.length,
emails.length + exactEmails.length,
circles.length + exactCircles.length,
rooms.length + exactRooms.length,
lookup.length
)
);
deferred.resolve(suggestions, exactMatches, moreResultsAvailable);
} else {
deferred.reject(result.ocs.meta.message);
}
@ -385,7 +401,7 @@
search.term.trim(),
perPage,
view.model
).done(function(suggestions) {
).done(function(suggestions, exactMatches, moreResultsAvailable) {
view._pendingOperationsCount--;
if (view._pendingOperationsCount === 0) {
$loading.addClass('hidden');
@ -401,10 +417,7 @@
// show a notice that the list is truncated
// this is the case if one of the search results is at least as long as the max result config option
if(oc_config['sharing.maxAutocompleteResults'] > 0 &&
Math.min(perPage, oc_config['sharing.maxAutocompleteResults'])
<= Math.max(users.length, groups.length, remotes.length, emails.length, lookup.length)) {
if(moreResultsAvailable) {
var message = t('core', 'This list is maybe truncated - please refine your search term to see more results.');
$('.ui-autocomplete').append('<li class="autocomplete-note">' + message + '</li>');
}