Skip to content

Commit 77b95cc

Browse files
ArtificialOwljuliusknorr
authored andcommitted
revert tests
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent 0fc8a0f commit 77b95cc

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

apps/files_sharing/tests/ApiTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,21 +811,19 @@ function testGetShareMultipleSharedFolder() {
811811
$result1 = $ocs->getShares('false','false','false', $this->subfolder);
812812
$ocs->cleanup();
813813

814-
// // test should return 2 shares within $this->folder, as the viewer have resharing rights:
815-
// // one from the owner, the second from the reshare
814+
// test should return one share within $this->folder
816815
$data1 = $result1->getData();
817-
$this->assertCount(2, $data1);
816+
$this->assertCount(1, $data1);
818817
$s1 = reset($data1);
819818

820819
//$request = $this->createRequest(['path' => $this->folder.$this->subfolder]);
821820
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
822821
$result2 = $ocs->getShares('false', 'false', 'false', $this->folder . $this->subfolder);
823822
$ocs->cleanup();
824823

825-
// // test should return 2 shares within $this->folder, as the viewer have resharing rights:
826-
// // one from the owner, the second from the reshare
824+
// test should return one share within $this->folder
827825
$data2 = $result2->getData();
828-
$this->assertCount(2, $data2);
826+
$this->assertCount(1, $data2);
829827
$s2 = reset($data2);
830828

831829
$this->assertEquals($this->subfolder, $s1['path']);

lib/private/Share20/DefaultShareProvider.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -617,18 +617,20 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs
617617
/**
618618
* Reshares for this user are shares where they are the owner.
619619
*/
620-
if ($node === null) {
621-
if ($reshares === false) {
622-
$qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)));
623-
} else {
620+
if ($reshares === false) {
621+
$qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)));
622+
} else {
623+
if ($node === null) {
624624
$qb->andWhere(
625625
$qb->expr()->orX(
626626
$qb->expr()->eq('uid_owner', $qb->createNamedParameter($userId)),
627627
$qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId))
628628
)
629629
);
630630
}
631-
} else {
631+
}
632+
633+
if ($node !== null) {
632634
$qb->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($node->getId())));
633635
}
634636

0 commit comments

Comments
 (0)