diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-08-11 17:24:54 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-08-26 11:54:24 +0200 |
commit | 4b08783946c8b2b1e731b3193e581b59bbbb15f5 (patch) | |
tree | 05081e72b84055b6bfb901ab65d3ef3ff19b1a5e /apps/files_sharing | |
parent | 16e5c15c283c40fd9c7a3f009f054b825bcadbb7 (diff) | |
download | nextcloud-server-4b08783946c8b2b1e731b3193e581b59bbbb15f5.tar.gz nextcloud-server-4b08783946c8b2b1e731b3193e581b59bbbb15f5.zip |
Use SearchResultSorter
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/api/sharees.php | 20 |
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 . |