Skip to content
Prev Previous commit
revert tests
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl authored and juliusknorr committed Nov 2, 2018
commit 77b95ccd12bb946cba96486d859b8241649868ca
10 changes: 4 additions & 6 deletions apps/files_sharing/tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,21 +811,19 @@ 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]);
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2);
$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']);
Expand Down
12 changes: 7 additions & 5 deletions lib/private/Share20/DefaultShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,18 +617,20 @@ 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)),
$qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId))
)
);
}
} else {
}

if ($node !== null) {
$qb->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($node->getId())));
}

Expand Down