]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not return shares with the current user
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Fri, 25 Oct 2019 09:15:02 +0000 (11:15 +0200)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Fri, 25 Oct 2019 19:40:50 +0000 (21:40 +0200)
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>
apps/files_sharing/lib/Controller/ShareAPIController.php
apps/files_sharing/tests/Controller/ShareAPIControllerTest.php

index c35faabfa12d3e927ff538588545cf52b98b3cf1..218d854f2f16d5f1d2cc32e9c17ed022be19f42d 100644 (file)
@@ -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;
index 7c77406e4b5f8bb28da80214d386fc805e1bf6e5..c972c5c794e53a56db1d7dce1890943bfd5d0232 100644 (file)
@@ -1018,7 +1018,6 @@ class ShareAPIControllerTest extends TestCase {
                                ],
                                [
                                        $file1UserShareOwnerExpected,
-                                       $file1UserShareRecipientExpected,
                                ]
                        ],
                        [
@@ -1034,7 +1033,6 @@ class ShareAPIControllerTest extends TestCase {
                                ],
                                [
                                        $file1UserShareOwnerExpected,
-                                       $file1UserShareRecipientExpected,
                                        $file1UserShareInitiatorExpected,
                                        $file1UserShareOtherExpected,
                                ]