summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-08-11 17:24:54 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-08-26 11:54:24 +0200
commit4b08783946c8b2b1e731b3193e581b59bbbb15f5 (patch)
tree05081e72b84055b6bfb901ab65d3ef3ff19b1a5e /apps/files_sharing
parent16e5c15c283c40fd9c7a3f009f054b825bcadbb7 (diff)
downloadnextcloud-server-4b08783946c8b2b1e731b3193e581b59bbbb15f5.tar.gz
nextcloud-server-4b08783946c8b2b1e731b3193e581b59bbbb15f5.zip
Use SearchResultSorter
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/api/sharees.php20
1 files changed, 4 insertions, 16 deletions
diff --git a/apps/files_sharing/api/sharees.php b/apps/files_sharing/api/sharees.php
index 7a3555e0a5b..120df126a7c 100644
--- a/apps/files_sharing/api/sharees.php
+++ b/apps/files_sharing/api/sharees.php
@@ -210,21 +210,10 @@ class Sharees {
// Sort sharees
- usort($sharees, function($a, $b) {
- $res = strcmp($a['label'], $b['label']);
-
- // If labels are equal sort by share type
- if ($res === 0) {
- $res = $a['value']['shareType'] - $b['value']['shareType'];
- }
-
- // If sharetype is equal compare shareWith
- if ($res === 0) {
- $res = strcmp($a['value']['shareWith'], $b['value']['shareWith']);
- }
-
- return $res;
- });
+ $sorter = new \OC\Share\SearchResultSorter($search,
+ 'label',
+ \OC::$server->getLogger());
+ usort($sharees, array($sorter, 'sort'));
//Pagination
$start = ($page - 1) * $per_page;
@@ -239,7 +228,6 @@ class Sharees {
$response->setItemsPerPage($per_page);
// TODO add other link rels
-
if ($tot > $end) {
$url = $this->urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/sharees?') .
'search=' . $search .