[Pkg-owncloud-commits] [owncloud] 16/457: add support for limit request parameter to getShareWith
David Prévot
taffit at moszumanska.debian.org
Sun Jun 28 20:05:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit ca341a8d59caa62a72762166378aadb32d60236c
Author: Craig Morrissey <craig at owncloud.com>
Date: Mon Nov 24 16:13:42 2014 -0500
add support for limit request parameter to getShareWith
---
core/ajax/share.php | 8 +++++---
core/js/share.js | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/core/ajax/share.php b/core/ajax/share.php
index a0db77f..e78d274 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -281,8 +281,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$users = array();
$limit = 0;
$offset = 0;
- while ($count < 15 && count($users) == $limit) {
- $limit = 15 - $count;
+ // limit defaults to 15 if not specified via request parameter and can be no larger than 500
+ $request_limit = min((int)$_GET['limit'] ?: 15, 500);
+ while ($count < $request_limit && count($users) == $limit) {
+ $limit = $request_limit - $count;
if ($shareWithinGroupOnly) {
$users = OC_Group::displayNamesInGroups($usergroups, (string)$_GET['search'], $limit, $offset);
} else {
@@ -319,7 +321,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
continue;
}
- if ($count < 15) {
+ if ($count < $request_limit) {
if (!isset($_GET['itemShares'])
|| !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])
|| !is_array((string)$_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])
diff --git a/core/js/share.js b/core/js/share.js
index 6723b82..d1ddd2c 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -491,7 +491,7 @@ OC.Share={
$('#shareWith').autocomplete({minLength: 2, delay: 750, source: function(search, response) {
var $loading = $('#dropdown .shareWithLoading');
$loading.removeClass('hidden');
- $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getShareWith', search: search.term.trim(), itemShares: OC.Share.itemShares, itemType: itemType }, function(result) {
+ $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getShareWith', search: search.term.trim(), limit: 200, itemShares: OC.Share.itemShares, itemType: itemType }, function(result) {
$loading.addClass('hidden');
if (result.status == 'success' && result.data.length > 0) {
$( "#shareWith" ).autocomplete( "option", "autoFocus", true );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list