From 8098abee608e58dad8b73a1151233be525c25483 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 25 Oct 2019 11:15:02 +0200 Subject: [PATCH] Do not return shares with the current user MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Getting the shares of a file no longer returns shares with the current user for consistency with the results when getting the shares including subfiles. Signed-off-by: Daniel Calviño Sánchez --- apps/files_sharing/lib/Controller/ShareAPIController.php | 4 ++++ .../files_sharing/tests/Controller/ShareAPIControllerTest.php | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index c35faabfa12..218d854f2f1 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -723,6 +723,10 @@ class ShareAPIController extends OCSController { $resharingRight = false; foreach ($shares as $share) { /** @var IShare $share */ + if ($share->getSharedWith() === $this->currentUser) { + continue; + } + try { $format = $this->formatShare($share, $path); $formatted[] = $format; diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 7c77406e4b5..c972c5c794e 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -1018,7 +1018,6 @@ class ShareAPIControllerTest extends TestCase { ], [ $file1UserShareOwnerExpected, - $file1UserShareRecipientExpected, ] ], [ @@ -1034,7 +1033,6 @@ class ShareAPIControllerTest extends TestCase { ], [ $file1UserShareOwnerExpected, - $file1UserShareRecipientExpected, $file1UserShareInitiatorExpected, $file1UserShareOtherExpected, ] -- 2.39.5