From 82c0e70490c3c590a7f360babbb00221ef4e1bf9 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Thu, 1 Nov 2018 16:46:38 +0100 Subject: [PATCH] revert tests Signed-off-by: Maxence Lange --- apps/files_sharing/tests/ApiTest.php | 10 ++++------ lib/private/Share20/DefaultShareProvider.php | 12 +++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index e3d0b2dbcdb00..0616daed62db6 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -811,10 +811,9 @@ function testGetShareMultipleSharedFolder() { $result1 = $ocs->getShares('false','false','false', $this->subfolder); $ocs->cleanup(); -// // test should return 2 shares within $this->folder, as the viewer have resharing rights: -// // one from the owner, the second from the reshare + // test should return one share within $this->folder $data1 = $result1->getData(); - $this->assertCount(2, $data1); + $this->assertCount(1, $data1); $s1 = reset($data1); //$request = $this->createRequest(['path' => $this->folder.$this->subfolder]); @@ -822,10 +821,9 @@ function testGetShareMultipleSharedFolder() { $result2 = $ocs->getShares('false', 'false', 'false', $this->folder . $this->subfolder); $ocs->cleanup(); -// // test should return 2 shares within $this->folder, as the viewer have resharing rights: -// // one from the owner, the second from the reshare + // test should return one share within $this->folder $data2 = $result2->getData(); - $this->assertCount(2, $data2); + $this->assertCount(1, $data2); $s2 = reset($data2); $this->assertEquals($this->subfolder, $s1['path']); diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 5a56290c1ca52..9ba7f6b7d706c 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -611,10 +611,10 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs /** * Reshares for this user are shares where they are the owner. */ - if ($node === null) { - if ($reshares === false) { - $qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId))); - } else { + if ($reshares === false) { + $qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId))); + } else { + if ($node === null) { $qb->andWhere( $qb->expr()->orX( $qb->expr()->eq('uid_owner', $qb->createNamedParameter($userId)), @@ -622,7 +622,9 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs ) ); } - } else { + } + + if ($node !== null) { $qb->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($node->getId()))); }