diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/WorkspaceController.php | 8 | ||||
-rw-r--r-- | lib/Service/ApiService.php | 2 | ||||
-rw-r--r-- | lib/Service/DocumentService.php | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/Controller/WorkspaceController.php b/lib/Controller/WorkspaceController.php index 565cabe57..99658fc5a 100644 --- a/lib/Controller/WorkspaceController.php +++ b/lib/Controller/WorkspaceController.php @@ -56,6 +56,7 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\OCSController; use OCP\DirectEditing\IManager as IDirectEditingManager; use OCP\DirectEditing\RegisterDirectEditorEvent; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; @@ -89,8 +90,10 @@ class WorkspaceController extends OCSController { 'Readme.md', 'readme.md' ]; + /** @var IEventDispatcher */ + private $eventDispatcher; - public function __construct($appName, IRequest $request, IRootFolder $rootFolder, IManager $shareManager, IDirectEditingManager $directEditingManager, IURLGenerator $urlGenerator, WorkspaceService $workspaceService, $userId) { + public function __construct($appName, IRequest $request, IRootFolder $rootFolder, IManager $shareManager, IDirectEditingManager $directEditingManager, IURLGenerator $urlGenerator, WorkspaceService $workspaceService, IEventDispatcher $eventDispatcher, $userId) { parent::__construct($appName, $request); $this->rootFolder = $rootFolder; $this->shareManager = $shareManager; @@ -98,6 +101,7 @@ class WorkspaceController extends OCSController { $this->userId = $userId; $this->directEditingManager = $directEditingManager; $this->urlGenerator = $urlGenerator; + $this->eventDispatcher = $eventDispatcher; } /** @@ -165,6 +169,8 @@ class WorkspaceController extends OCSController { * @NoAdminRequired */ public function direct(string $path): DataResponse { + $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); + try { $folder = $this->rootFolder->getUserFolder($this->userId)->get($path); if ($folder instanceof Folder) { diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index a43498ceb..a125074f0 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -159,7 +159,7 @@ class ApiService { $file = $this->documentService->getFileForSession($session, $token); try { - $result['document'] = $this->documentService->autosave($file, $documentId, $version, $autosaveContent, $force, $manualSave, $token, $this->request->getParam('filePath'), $userId); + $result['document'] = $this->documentService->autosave($file, $documentId, $version, $autosaveContent, $force, $manualSave, $token, $this->request->getParam('filePath')); } catch (DocumentSaveConflictException $e) { try { $result['outsideChange'] = $file->getContent(); diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index be682251d..27be4956d 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -240,7 +240,7 @@ class DocumentService { * @throws NotPermittedException * @throws ShareNotFound */ - public function autosave($file, $documentId, $version, $autoaveDocument, $force = false, $manualSave = false, $shareToken = null, $filePath = null, $userId = null): Document { + public function autosave($file, $documentId, $version, $autoaveDocument, $force = false, $manualSave = false, $shareToken = null, $filePath = null): Document { /** @var Document $document */ $document = $this->documentMapper->find($documentId); |