summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2019-10-25 11:15:02 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2019-10-25 21:40:50 +0200
commit8098abee608e58dad8b73a1151233be525c25483 (patch)
treec20e892b3ecaa0b3effd85dc6596770c8db7a281 /apps/files_sharing
parent1afefc2d9a0dba59fc083d4682ca5787023be791 (diff)
downloadnextcloud-server-8098abee608e58dad8b73a1151233be525c25483.tar.gz
nextcloud-server-8098abee608e58dad8b73a1151233be525c25483.zip
Do not return shares with the current user
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 <danxuliu@gmail.com>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php4
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php2
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,
]