From 909d6a87c1e7c3620862c49b8fb896ef3dd5e8af Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Thu, 27 Mar 2025 16:28:58 +0100 Subject: [PATCH 1/2] fix(files_reminders): Lower disabled notifications app error to info Signed-off-by: Louis Chemineau --- .../lib/Listener/LoadAdditionalScriptsListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php index a0173aabc6469..40aef1f9f69fd 100644 --- a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php +++ b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php @@ -31,7 +31,7 @@ public function handle(Event $event): void { } if (!$this->appManager->isEnabledForUser('notifications')) { - $this->logger->error('Failed to register the `files_reminders` app. This could happen due to the `notifications` app being disabled.', ['app' => 'files_reminders']); + $this->logger->info('Skipped registering the `files_reminders` app because the `notifications` app is disabled.', ['app' => 'files_reminders']); return; } From 89da238b700ff89b029d0899a7be3ce1b57ff725 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Tue, 1 Apr 2025 15:19:43 +0200 Subject: [PATCH 2/2] fix(files_reminder): Replace error log by setup check Signed-off-by: Louis Chemineau --- .../lib/AppInfo/Application.php | 2 + .../LoadAdditionalScriptsListener.php | 1 - .../lib/SetupChecks/NeedNotificationsApp.php | 37 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php diff --git a/apps/files_reminders/lib/AppInfo/Application.php b/apps/files_reminders/lib/AppInfo/Application.php index f0a3cc0f6f50c..0ad503264d24a 100644 --- a/apps/files_reminders/lib/AppInfo/Application.php +++ b/apps/files_reminders/lib/AppInfo/Application.php @@ -42,5 +42,7 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class); + + $context->registerSetupCheck(NeedNotificationsApp::class); } } diff --git a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php index 40aef1f9f69fd..13bf670f401ba 100644 --- a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php +++ b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php @@ -31,7 +31,6 @@ public function handle(Event $event): void { } if (!$this->appManager->isEnabledForUser('notifications')) { - $this->logger->info('Skipped registering the `files_reminders` app because the `notifications` app is disabled.', ['app' => 'files_reminders']); return; } diff --git a/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php b/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php new file mode 100644 index 0000000000000..2fc80094152be --- /dev/null +++ b/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php @@ -0,0 +1,37 @@ +l10n->t('Files reminder'); + } + + public function getCategory(): string { + return 'system'; + } + + public function run(): SetupResult { + if ($this->appManager->isInstalled('notifications')) { + return SetupResult::success($this->l10n->t('This files_reminder can work properly.')); + } else { + return SetupResult::warning($this->l10n->t('The files_reminder app needs the notification app to work properly. You should either enable notifications or disable files_reminder.')); + } + } +}