From c5cb2e86e3887d223bedc7ea7d5052eab518bde8 Mon Sep 17 00:00:00 2001 From: Simon L Date: Wed, 7 Feb 2024 14:29:22 +0100 Subject: [PATCH 1/2] do not break personal settings page is viewer is not there Signed-off-by: Simon L --- apps/settings/lib/Settings/Personal/ServerDevNotice.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/settings/lib/Settings/Personal/ServerDevNotice.php b/apps/settings/lib/Settings/Personal/ServerDevNotice.php index 3cb9a3a972fb2..8e08b2c8c7f3d 100644 --- a/apps/settings/lib/Settings/Personal/ServerDevNotice.php +++ b/apps/settings/lib/Settings/Personal/ServerDevNotice.php @@ -78,11 +78,8 @@ public function getForm(): TemplateResponse { $hasInitialState = false; - // viewer is default enabled and this makes a zero-cost assertion for Psalm - assert(class_exists(LoadViewer::class)); - - // If the Reasons to use Nextcloud.pdf file is here, let's init Viewer - if ($userFolder->nodeExists('Reasons to use Nextcloud.pdf')) { + // If the Reasons to use Nextcloud.pdf file is here, let's init Viewer, also check that Viewer is there + if (class_exists(LoadViewer::class) && $userFolder->nodeExists('Reasons to use Nextcloud.pdf')) { $this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer()); $hasInitialState = true; } From 86c8584cf0e011477dfba215117c21d1dd8e3189 Mon Sep 17 00:00:00 2001 From: Simon L Date: Thu, 8 Feb 2024 10:44:19 +0100 Subject: [PATCH 2/2] fix psalm Signed-off-by: Simon L --- apps/settings/lib/Settings/Personal/ServerDevNotice.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/settings/lib/Settings/Personal/ServerDevNotice.php b/apps/settings/lib/Settings/Personal/ServerDevNotice.php index 8e08b2c8c7f3d..3f1be7432d017 100644 --- a/apps/settings/lib/Settings/Personal/ServerDevNotice.php +++ b/apps/settings/lib/Settings/Personal/ServerDevNotice.php @@ -80,6 +80,9 @@ public function getForm(): TemplateResponse { // If the Reasons to use Nextcloud.pdf file is here, let's init Viewer, also check that Viewer is there if (class_exists(LoadViewer::class) && $userFolder->nodeExists('Reasons to use Nextcloud.pdf')) { + /** + * @psalm-suppress UndefinedClass, InvalidArgument + */ $this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer()); $hasInitialState = true; }