|
326 | 326 |
|
327 | 327 | var suggestions = exactMatches.concat(users).concat(groups).concat(remotes).concat(remoteGroups).concat(emails).concat(circles).concat(rooms).concat(lookup); |
328 | 328 |
|
329 | | - deferred.resolve(suggestions, exactMatches); |
| 329 | + var moreResultsAvailable = |
| 330 | + ( |
| 331 | + oc_config['sharing.maxAutocompleteResults'] > 0 |
| 332 | + && Math.min(perPage, oc_config['sharing.maxAutocompleteResults']) |
| 333 | + <= Math.max( |
| 334 | + users.length + exactUsers.length, |
| 335 | + groups.length + exactGroups.length, |
| 336 | + remoteGroups.length + exactRemoteGroups.length, |
| 337 | + remotes.length + exactRemotes.length, |
| 338 | + emails.length + exactEmails.length, |
| 339 | + circles.length + exactCircles.length, |
| 340 | + rooms.length + exactRooms.length, |
| 341 | + lookup.length |
| 342 | + ) |
| 343 | + ); |
| 344 | + |
| 345 | + deferred.resolve(suggestions, exactMatches, moreResultsAvailable); |
330 | 346 | } else { |
331 | 347 | deferred.reject(result.ocs.meta.message); |
332 | 348 | } |
|
380 | 396 | $shareWithField.removeClass('error') |
381 | 397 | .tooltip('hide'); |
382 | 398 |
|
383 | | - var perPage = 200; |
| 399 | + var perPage = parseInt(oc_config['sharing.maxAutocompleteResults'], 10) || 200; |
384 | 400 | this._getSuggestions( |
385 | 401 | search.term.trim(), |
386 | 402 | perPage, |
387 | 403 | view.model |
388 | | - ).done(function(suggestions) { |
| 404 | + ).done(function(suggestions, exactMatches, moreResultsAvailable) { |
389 | 405 | view._pendingOperationsCount--; |
390 | 406 | if (view._pendingOperationsCount === 0) { |
391 | 407 | $loading.addClass('hidden'); |
|
401 | 417 |
|
402 | 418 | // show a notice that the list is truncated |
403 | 419 | // this is the case if one of the search results is at least as long as the max result config option |
404 | | - if(oc_config['sharing.maxAutocompleteResults'] > 0 && |
405 | | - Math.min(perPage, oc_config['sharing.maxAutocompleteResults']) |
406 | | - <= Math.max(users.length, groups.length, remotes.length, emails.length, lookup.length)) { |
407 | | - |
| 420 | + if(moreResultsAvailable) { |
408 | 421 | var message = t('core', 'This list is maybe truncated - please refine your search term to see more results.'); |
409 | 422 | $('.ui-autocomplete').append('<li class="autocomplete-note">' + message + '</li>'); |
410 | 423 | } |
|
557 | 570 | $shareWithField.focus(); |
558 | 571 | }; |
559 | 572 |
|
560 | | - var perPage = 200; |
| 573 | + var perPage = parseInt(oc_config['sharing.maxAutocompleteResults'], 10) || 200; |
561 | 574 | var onlyExactMatches = true; |
562 | 575 | this._getSuggestions( |
563 | 576 | $shareWithField.val(), |
|
0 commit comments