From 614981ae9abbfed04b9d1b3663f7e9d0aa85404c Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Wed, 15 Feb 2023 16:16:54 +0100 Subject: feat(directediting): Allow opening by file id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files/lib/Controller/DirectEditingController.php | 5 ++--- apps/files/lib/DirectEditingCapabilities.php | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'apps/files/lib') diff --git a/apps/files/lib/Controller/DirectEditingController.php b/apps/files/lib/Controller/DirectEditingController.php index c67150be8d4..9b48d6958aa 100644 --- a/apps/files/lib/Controller/DirectEditingController.php +++ b/apps/files/lib/Controller/DirectEditingController.php @@ -35,7 +35,6 @@ use OCP\IRequest; use OCP\IURLGenerator; class DirectEditingController extends OCSController { - /** @var IEventDispatcher */ private $eventDispatcher; @@ -94,14 +93,14 @@ class DirectEditingController extends OCSController { /** * @NoAdminRequired */ - public function open(string $path, string $editorId = null): DataResponse { + public function open(string $path, string $editorId = null, ?int $fileId = null): DataResponse { if (!$this->directEditingManager->isEnabled()) { return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR); } $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); try { - $token = $this->directEditingManager->open($path, $editorId); + $token = $this->directEditingManager->open($path, $editorId, $fileId); return new DataResponse([ 'url' => $this->urlGenerator->linkToRouteAbsolute('files.DirectEditingView.edit', ['token' => $token]) ]); diff --git a/apps/files/lib/DirectEditingCapabilities.php b/apps/files/lib/DirectEditingCapabilities.php index 782f7019ac7..10c8e95105a 100644 --- a/apps/files/lib/DirectEditingCapabilities.php +++ b/apps/files/lib/DirectEditingCapabilities.php @@ -1,4 +1,5 @@ @@ -29,7 +30,6 @@ use OCP\Capabilities\IInitialStateExcludedCapability; use OCP\IURLGenerator; class DirectEditingCapabilities implements ICapability, IInitialStateExcludedCapability { - protected DirectEditingService $directEditingService; protected IURLGenerator $urlGenerator; @@ -43,7 +43,8 @@ class DirectEditingCapabilities implements ICapability, IInitialStateExcludedCap 'files' => [ 'directEditing' => [ 'url' => $this->urlGenerator->linkToOCSRouteAbsolute('files.DirectEditing.info'), - 'etag' => $this->directEditingService->getDirectEditingETag() + 'etag' => $this->directEditingService->getDirectEditingETag(), + 'supportsFileId' => true, ] ], ]; -- cgit v1.2.3