Merge pull request #15182 from rullzer/fix-8231
ajax/share.php should return correct list of suggestions
This commit is contained in:
commit
20eaadd72b
|
@ -255,6 +255,14 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
$usergroups = OC_Group::getUserGroups(OC_User::getUser());
|
$usergroups = OC_Group::getUserGroups(OC_User::getUser());
|
||||||
$groups = array_intersect($groups, $usergroups);
|
$groups = array_intersect($groups, $usergroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sharedUsers = [];
|
||||||
|
$sharedGroups = [];
|
||||||
|
if (isset($_GET['itemShares'])) {
|
||||||
|
$sharedUsers = isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) ? $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER] : [];
|
||||||
|
$sharedGroups = isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) ? $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP] : [];
|
||||||
|
}
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$users = array();
|
$users = array();
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
@ -266,8 +274,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
} else {
|
} else {
|
||||||
$users = OC_User::getDisplayNames((string)$_GET['search'], $limit, $offset);
|
$users = OC_User::getDisplayNames((string)$_GET['search'], $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset += $limit;
|
$offset += $limit;
|
||||||
foreach ($users as $uid => $displayName) {
|
foreach ($users as $uid => $displayName) {
|
||||||
|
if (in_array($uid, $sharedUsers)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ((!isset($_GET['itemShares'])
|
if ((!isset($_GET['itemShares'])
|
||||||
|| !is_array((string)$_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])
|
|| !is_array((string)$_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])
|
||||||
|| !in_array($uid, (string)$_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]))
|
|| !in_array($uid, (string)$_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]))
|
||||||
|
@ -288,6 +301,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
$l = \OC::$server->getL10N('core');
|
$l = \OC::$server->getL10N('core');
|
||||||
|
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
|
if (in_array($group, $sharedGroups)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($count < 15) {
|
if ($count < 15) {
|
||||||
if (!isset($_GET['itemShares'])
|
if (!isset($_GET['itemShares'])
|
||||||
|| !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])
|
|| !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])
|
||||||
|
|
Loading…
Reference in New Issue