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
12 changes: 2 additions & 10 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
use OCA\Libresign\Events\SendSignNotificationEvent;
use OCA\Libresign\Events\SignedEvent;
use OCA\Libresign\Events\SignRequestCanceledEvent;
use OCA\Libresign\Files\TemplateLoader as FilesTemplateLoader;
use OCA\Libresign\Files\TemplateLoader;
use OCA\Libresign\Listener\BeforeNodeDeletedListener;
use OCA\Libresign\Listener\LoadAdditionalListener;
use OCA\Libresign\Listener\LoadSidebarListener;
use OCA\Libresign\Listener\MailNotifyListener;
use OCA\Libresign\Listener\NotificationListener;
use OCA\Libresign\Listener\SignedCallbackListener;
Expand All @@ -31,7 +30,6 @@
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Cache\CacheEntryRemovedEvent;
use OCP\Files\Events\Node\BeforeNodeDeletedEvent;
use OCP\User\Events\UserDeletedEvent;
Expand All @@ -47,12 +45,6 @@ public function __construct() {
}

public function boot(IBootContext $context): void {
$server = $context->getServerContainer();

/** @var IEventDispatcher $dispatcher */
$dispatcher = $server->get(IEventDispatcher::class);

FilesTemplateLoader::register($dispatcher);
}

public function register(IRegistrationContext $context): void {
Expand All @@ -62,7 +54,7 @@ public function register(IRegistrationContext $context): void {

$context->registerNotifierService(Notifier::class);

$context->registerEventListener(LoadSidebar::class, LoadSidebarListener::class);
$context->registerEventListener(LoadSidebar::class, TemplateLoader::class);
$context->registerEventListener(BeforeNodeDeletedEvent::class, BeforeNodeDeletedListener::class);
$context->registerEventListener(CacheEntryRemovedEvent::class, BeforeNodeDeletedListener::class);
$context->registerEventListener(SignedEvent::class, SignedCallbackListener::class);
Expand Down
16 changes: 11 additions & 5 deletions lib/Files/TemplateLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
use OCA\Libresign\Helper\ValidateHelper;
use OCA\Libresign\Service\AccountService;
use OCA\Libresign\Service\IdentifyMethodService;
use OCP\App\IAppManager;
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\EventDispatcher\IEventListener;
use OCP\IAppConfig;
use OCP\IRequest;
use OCP\IUserSession;
use OCP\Util;

/**
* @template-implements IEventListener<Event>
Expand All @@ -36,17 +37,19 @@ public function __construct(
private IdentifyMethodService $identifyMethodService,
private CertificateEngineFactory $certificateEngineFactory,
private IAppConfig $appConfig,
private IAppManager $appManager,
) {
}

public static function register(IEventDispatcher $dispatcher): void {
$dispatcher->addServiceListener(LoadSidebar::class, self::class);
}

public function handle(Event $event): void {
if (!($event instanceof LoadSidebar)) {
return;
}

if (!$this->appManager->isEnabledForUser('libresign')) {
return;
}

$this->initialState->provideInitialState(
'certificate_ok',
$this->certificateEngineFactory->getEngine()->isSetupOk()
Expand All @@ -68,5 +71,8 @@ public function handle(Event $event): void {
} catch (LibresignException) {
$this->initialState->provideInitialState('can_request_sign', false);
}

Util::addScript(Application::APP_ID, 'libresign-tab');
Util::addStyle(Application::APP_ID, 'icons');
}
}
38 changes: 0 additions & 38 deletions lib/Listener/LoadSidebarListener.php

This file was deleted.

16 changes: 1 addition & 15 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<file src="lib/AppInfo/Application.php">
<InvalidArgument>
<code><![CDATA[LoadAdditionalListener::class]]></code>
<code><![CDATA[LoadSidebarListener::class]]></code>
<code><![CDATA[registerEventListener]]></code>
</InvalidArgument>
<UndefinedClass>
Expand Down Expand Up @@ -61,9 +60,6 @@
</UndefinedClass>
</file>
<file src="lib/Files/TemplateLoader.php">
<InvalidArgument>
<code><![CDATA[addServiceListener]]></code>
</InvalidArgument>
</file>
<file src="lib/Handler/CertificateEngine/CfsslHandler.php">
<InvalidArgument>
Expand All @@ -86,17 +82,7 @@
<code><![CDATA[LoadAdditionalListener]]></code>
</UndefinedDocblockClass>
</file>
<file src="lib/Listener/LoadSidebarListener.php">
<InvalidTemplateParam>
<code><![CDATA[IEventListener]]></code>
</InvalidTemplateParam>
<MoreSpecificImplementedParamType>
<code><![CDATA[$event]]></code>
</MoreSpecificImplementedParamType>
<UndefinedDocblockClass>
<code><![CDATA[LoadSidebarListener]]></code>
</UndefinedDocblockClass>
</file>

<file src="lib/Listener/TwofactorGatewayListener.php">
<UndefinedClass>
<code><![CDATA[Factory]]></code>
Expand Down
Loading