diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-12-02 18:16:33 -0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-12-03 08:13:22 +0100 |
commit | f2c7ca45840d20a8b6c40937958f4e5a8953d0dd (patch) | |
tree | cf13a79fa5512cda9d480d901549e7b9113acce7 /apps/files_sharing/lib | |
parent | 3a86b9925693fbcbaf0adb64a8d85500f055ef38 (diff) | |
download | nextcloud-server-f2c7ca45840d20a8b6c40937958f4e5a8953d0dd.tar.gz nextcloud-server-f2c7ca45840d20a8b6c40937958f4e5a8953d0dd.zip |
fixing tests + avoid duplicate in getFormattedShares()
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 208ea79c2ae..1dac86a9514 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -759,15 +759,18 @@ class ShareAPIController extends OCSController { $shares = $this->getSharesFromNode($viewer, $node, $reShares); - $formatted = $miniFormatted = []; + $known = $formatted = $miniFormatted = []; $resharingRight = false; foreach ($shares as $share) { + if (in_array($share->getId(), $known) || $share->getSharedWith() === $this->currentUser) { + continue; + } + + $known[] = $share->getId(); try { /** @var IShare $share */ $format = $this->formatShare($share, $node); - if ($share->getSharedWith() !== $this->currentUser) { - $formatted[] = $format; - } + $formatted[] = $format; // let's also build a list of shares created // by the current user only, in case |