diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-01-07 12:57:57 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-01-07 19:35:45 +0100 |
commit | 445274cf93dbae31c6995008dcc0f9834c05d9ca (patch) | |
tree | 5f33fb92ff778f2a7effd66a3bd92e345d4c1bc6 /apps/files_sharing/lib | |
parent | fbed6a3416dd96e3698575f67dc57fc861c2ed46 (diff) | |
download | nextcloud-server-445274cf93dbae31c6995008dcc0f9834c05d9ca.tar.gz nextcloud-server-445274cf93dbae31c6995008dcc0f9834c05d9ca.zip |
Add pending share list to frontend
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/AppInfo/Application.php | 9 | ||||
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 30 |
2 files changed, 34 insertions, 5 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 48802617b4f..5a18cce8e49 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -278,6 +278,15 @@ class Application extends App { 'name' => $l->t('Deleted shares'), ]); + array_push($sharingSublistArray, [ + 'id' => 'pendingshares', + 'appname' => 'files_sharing', + 'script' => 'list.php', + 'order' => 19, + 'name' => $l->t('Pending shares'), + ]); + + // show_Quick_Access stored as string \OCA\Files\App::getNavigationManager()->add([ 'id' => 'shareoverview', diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index e7c9a414958..b71d3dac3a7 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -1100,11 +1100,31 @@ class ShareAPIController extends OCSController { } } - $result = array_map(function (IShare $share) { - return [ - 'id' => $share->getFullId(), - ]; - }, $pendingShares); + $result = array_filter(array_map(function (IShare $share) { + $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); + $nodes = $userFolder->getById($share->getNodeId()); + if (empty($nodes)) { + // fallback to guessing the path + $node = $userFolder->get($share->getTarget()); + if ($node === null || $share->getTarget() === '') { + return null; + } + } else { + $node = $nodes[0]; + } + + try { + $formattedShare = $this->formatShare($share, $node); + $formattedShare['status'] = $share->getStatus(); + $formattedShare['path'] = $share->getNode()->getName(); + $formattedShare['permissions'] = 0; + return $formattedShare; + } catch (NotFoundException $e) { + return null; + } + }, $pendingShares), function ($entry) { + return $entry !== null; + }); return new DataResponse($result); } |