Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions apps/files_sharing/lib/API/Share20OCS.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function getShare($id) {
if ($this->canAccessShare($share)) {
try {
$share = $this->formatShare($share);
return new DataResponse(['data' => [$share]]);
return new DataResponse([$share]);
} catch (NotFoundException $e) {
//Fall trough
}
Expand Down Expand Up @@ -339,7 +339,7 @@ public function createShare() {
*/
$existingShares = $this->shareManager->getSharesBy($this->currentUser->getUID(), \OCP\Share::SHARE_TYPE_LINK, $path, false, 1, 0);
if (!empty($existingShares)) {
return new DataResponse(['data' => $this->formatShare($existingShares[0])]);
return new DataResponse($this->formatShare($existingShares[0]));
}

$publicUpload = $this->request->getParam('publicUpload', null);
Expand Down Expand Up @@ -408,7 +408,7 @@ public function createShare() {

$output = $this->formatShare($share);

return new DataResponse(['data' => $output]);
return new DataResponse($output);
}

/**
Expand All @@ -432,7 +432,7 @@ private function getSharedWithMe($node = null) {
}
}

return new DataResponse(['data' => $formatted]);
return new DataResponse($formatted);
}

/**
Expand Down Expand Up @@ -466,7 +466,7 @@ private function getSharesInDir($folder) {
}
}

return new DataResponse(['data' => $formatted]);
return new DataResponse($formatted);
}

/**
Expand Down Expand Up @@ -537,7 +537,7 @@ public function getShares() {
}
}

return new DataResponse(['data' => $formatted]);
return new DataResponse($formatted);
}

/**
Expand Down Expand Up @@ -671,7 +671,7 @@ public function updateShare($id) {
throw new OCSBadRequestException($e->getMessage());
}

return new DataResponse(['data' => $this->formatShare($share)]);
return new DataResponse($this->formatShare($share));
}

/**
Expand Down
31 changes: 15 additions & 16 deletions apps/files_sharing/tests/API/Share20OCSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
namespace OCA\Files_Sharing\Tests\API;

use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\IL10N;
use OCA\Files_Sharing\API\Share20OCS;
use OCP\Files\NotFoundException;
Expand All @@ -35,7 +34,6 @@
use OCP\IUser;
use OCP\Files\IRootFolder;
use OCP\Lock\LockedException;
use Punic\Data;

/**
* Class Share20OCSTest
Expand Down Expand Up @@ -485,7 +483,7 @@ public function testGetShare(\OCP\Share\IShare $share, array $result) {
['group', $group],
]));

$this->assertEquals($result, $ocs->getShare($share->getId())->getData()['data'][0]);
$this->assertEquals($result, $ocs->getShare($share->getId())->getData()[0]);
}

/**
Expand Down Expand Up @@ -706,6 +704,7 @@ public function testCreateShareUser() {
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);

/** @var \OCA\Files_Sharing\API\Share20OCS $ocs */
$ocs = $this->getMockBuilder('OCA\Files_Sharing\API\Share20OCS')
->setConstructorArgs([
$this->appName,
Expand Down Expand Up @@ -766,7 +765,7 @@ public function testCreateShareUser() {
}))
->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->createShare();

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -879,7 +878,7 @@ public function testCreateShareGroup() {
}))
->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->createShare();

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1049,7 +1048,7 @@ public function testCreateShareLinkPublicUploadFolder() {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->createShare();

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1093,7 +1092,7 @@ public function testCreateShareLinkPassword() {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->createShare();

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1140,7 +1139,7 @@ public function testCreateShareValidExpireDate() {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->createShare();

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1337,7 +1336,7 @@ public function testUpdateLinkShareClear() {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->updateShare(42);

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1377,7 +1376,7 @@ public function testUpdateLinkShareSet() {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->updateShare(42);

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1415,7 +1414,7 @@ public function testUpdateLinkShareEnablePublicUpload($params) {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->updateShare(42);

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1562,7 +1561,7 @@ public function testUpdateLinkSharePasswordDoesNotChangeOther() {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->updateShare(42);

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1605,7 +1604,7 @@ public function testUpdateLinkShareExpireDateDoesNotChangeOther() {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->updateShare(42);

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1645,7 +1644,7 @@ public function testUpdateLinkSharePublicUploadDoesNotChangeOther() {
})
)->will($this->returnArgument(0));

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->updateShare(42);

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1687,7 +1686,7 @@ public function testUpdateLinkSharePermissions() {

$this->shareManager->method('getSharedWith')->willReturn([]);

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->updateShare(42);

$this->assertInstanceOf(get_class($expected), $result);
Expand Down Expand Up @@ -1754,7 +1753,7 @@ public function testUpdateOtherPermissions() {

$this->shareManager->method('getSharedWith')->willReturn([]);

$expected = new DataResponse(['data' => null]);
$expected = new DataResponse(null);
$result = $ocs->updateShare(42);

$this->assertInstanceOf(get_class($expected), $result);
Expand Down
Loading