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
1 change: 0 additions & 1 deletion apps/dav/lib/Connector/Sabre/ServerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ public function createServer(
$server->addPlugin(new SharesPlugin(
$tree,
$this->userSession,
$userFolder,
\OCP\Server::get(\OCP\Share\IManager::class)
));
$server->addPlugin(new CommentPropertiesPlugin(\OCP\Server::get(ICommentsManager::class), $this->userSession));
Expand Down
15 changes: 3 additions & 12 deletions apps/dav/lib/Connector/Sabre/SharesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
public const SHARETYPES_PROPERTYNAME = '{http://owncloud.org/ns}share-types';
public const SHAREES_PROPERTYNAME = '{http://nextcloud.org/ns}sharees';

/**
* Reference to main server object
*
* @var \Sabre\DAV\Server
*/
private $server;
private \Sabre\DAV\Server $server;
private string $userId;

/** @var IShare[][] */
Expand All @@ -54,8 +49,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {

public function __construct(
private Tree $tree,
private IUserSession $userSession,
private Folder $userFolder,
IUserSession $userSession,
private IManager $shareManager,
) {
$this->userId = $userSession->getUser()->getUID();
Expand Down Expand Up @@ -206,10 +200,7 @@ public function handleGetProperties(

$propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode): ShareTypeList {
$shares = $this->getShares($sabreNode);

$shareTypes = array_unique(array_map(function (IShare $share) {
return $share->getShareType();
}, $shares));
$shareTypes = array_unique(array_map(static fn (IShare $share): int => $share->getShareType(), $shares));

return new ShareTypeList($shareTypes);
});
Expand Down
1 change: 0 additions & 1 deletion apps/dav/lib/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ public function __construct(
$this->server->addPlugin(new SharesPlugin(
$this->server->tree,
$userSession,
$userFolder,
$shareManager,
));
$this->server->addPlugin(new CommentPropertiesPlugin(
Expand Down
3 changes: 0 additions & 3 deletions apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class SharesPluginTest extends \Test\TestCase {
private \Sabre\DAV\Server $server;
private \Sabre\DAV\Tree&MockObject $tree;
private \OCP\Share\IManager&MockObject $shareManager;
private Folder&MockObject $userFolder;
private SharesPlugin $plugin;

protected function setUp(): void {
Expand All @@ -43,12 +42,10 @@ protected function setUp(): void {
$userSession->expects($this->once())
->method('getUser')
->willReturn($user);
$this->userFolder = $this->createMock(Folder::class);

$this->plugin = new SharesPlugin(
$this->tree,
$userSession,
$this->userFolder,
$this->shareManager
);
$this->plugin->initialize($this->server);
Expand Down
Loading