Skip to content

Commit

Permalink
Merge pull request #3486 from LibreSign/backport/3485/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: prevent js error when disabled for user
  • Loading branch information
vitormattos authored Aug 2, 2024
2 parents 04439ce + 0f0d7e0 commit 5c4392f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Listener/LoadSidebarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use OCA\Files\Event\LoadSidebar;
use OCA\Libresign\AppInfo\Application;
use OCP\App\IAppManager;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Util;
Expand All @@ -34,11 +35,19 @@
* @template-implements IEventListener<Event|LoadSidebar>
*/
class LoadSidebarListener implements IEventListener {
public function __construct(
private IAppManager $appManager,
) {
}
public function handle(Event $event): void {
if (!($event instanceof LoadSidebar)) {
return;
}

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

Util::addScript(Application::APP_ID, 'libresign-tab');
Util::addStyle(Application::APP_ID, 'icons');
}
Expand Down

0 comments on commit 5c4392f

Please sign in to comment.