Skip to content

Commit

Permalink
fix: Dispatch render reference event for collabora
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Knorr <[email protected]>
Signed-off-by: Elizabeth Danzberger <[email protected]>
  • Loading branch information
juliusknorr authored and elzody committed Dec 2, 2024
1 parent f1e01ef commit 60f53de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/Listener/LoadViewerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
use OCA\Richdocuments\PermissionManager;
use OCA\Richdocuments\Service\InitialStateService;
use OCA\Viewer\Event\LoadViewer;
use OCP\Collaboration\Reference\RenderReferenceEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

Expand All @@ -24,12 +26,15 @@ class LoadViewerListener implements IEventListener {
private $permissionManager;
/** @var InitialStateService */
private $initialStateService;
/** @var IEventDispatcher */
private $eventDispatcher;

private ?string $userId = null;

public function __construct(PermissionManager $permissionManager, InitialStateService $initialStateService, ?string $userId) {
public function __construct(PermissionManager $permissionManager, InitialStateService $initialStateService, IEventDispatcher $eventDispatcher, ?string $userId) {
$this->permissionManager = $permissionManager;
$this->initialStateService = $initialStateService;
$this->eventDispatcher = $eventDispatcher;
$this->userId = $userId;
}

Expand All @@ -40,6 +45,7 @@ public function handle(Event $event): void {
if ($this->permissionManager->isEnabledForUser() && $this->userId !== null) {
$this->initialStateService->provideCapabilities();
Util::addScript('richdocuments', 'richdocuments-viewer', 'viewer');
$this->eventDispatcher->dispatchTyped(new RenderReferenceEvent());
}
}
}

0 comments on commit 60f53de

Please sign in to comment.