diff options
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php | 2 | ||||
-rw-r--r-- | apps/files/lib/Capabilities.php | 16 | ||||
-rw-r--r-- | apps/files/lib/Controller/DirectEditingController.php | 6 |
3 files changed, 18 insertions, 6 deletions
diff --git a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php index 77907fab281..8d4a3f23787 100644 --- a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php +++ b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php @@ -7,7 +7,7 @@ use OCP\DirectEditing\IManager; class CleanupDirectEditingTokens extends TimedJob { - const INTERVAL_MINUTES = 15 * 60; + private const INTERVAL_MINUTES = 15 * 60; /** * @var IManager diff --git a/apps/files/lib/Capabilities.php b/apps/files/lib/Capabilities.php index c37e32b6b59..19b59971c4c 100644 --- a/apps/files/lib/Capabilities.php +++ b/apps/files/lib/Capabilities.php @@ -30,6 +30,8 @@ use OCP\Capabilities\ICapability; use OCP\DirectEditing\ACreateEmpty; use OCP\DirectEditing\ACreateFromTemplate; use OCP\DirectEditing\IEditor; +use OCP\DirectEditing\RegisterDirectEditorEvent; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; /** @@ -38,17 +40,25 @@ use OCP\IConfig; * @package OCA\Files */ class Capabilities implements ICapability { + /** @var IConfig */ protected $config; + /** @var Manager */ + protected $directEditingManager; + + /** @var IEventDispatcher */ + protected $eventDispatcher; + /** * Capabilities constructor. * * @param IConfig $config */ - public function __construct(IConfig $config, Manager $manager) { + public function __construct(IConfig $config, Manager $manager, IEventDispatcher $eventDispatcher) { $this->config = $config; $this->directEditingManager = $manager; + $this->eventDispatcher = $eventDispatcher; } /** @@ -66,7 +76,9 @@ class Capabilities implements ICapability { ]; } - private function getDirectEditingCapabilitites() { + private function getDirectEditingCapabilitites(): array { + $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); + $capabilities = [ 'editors' => [], 'creators' => [] diff --git a/apps/files/lib/Controller/DirectEditingController.php b/apps/files/lib/Controller/DirectEditingController.php index e8791316442..11d09e2f074 100644 --- a/apps/files/lib/Controller/DirectEditingController.php +++ b/apps/files/lib/Controller/DirectEditingController.php @@ -66,7 +66,7 @@ class DirectEditingController extends OCSController { * @NoAdminRequired */ public function create(string $path, string $editorId, string $creatorId, string $templateId = null): DataResponse { - $this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager)); + $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); try { $token = $this->directEditingManager->create($path, $editorId, $creatorId, $templateId); @@ -83,7 +83,7 @@ class DirectEditingController extends OCSController { * @NoAdminRequired */ public function open(int $fileId, string $editorId = null): DataResponse { - $this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager)); + $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); try { $token = $this->directEditingManager->open($fileId, $editorId); @@ -102,7 +102,7 @@ class DirectEditingController extends OCSController { * @NoAdminRequired */ public function templates(string $editorId, string $creatorId): DataResponse { - $this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager)); + $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); try { return new DataResponse($this->directEditingManager->getTemplates($editorId, $creatorId)); |