Skip to content

Commit 224720f

Browse files
committed
fix(files_reminder): Replace error log by setup check
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent 04d4945 commit 224720f

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

apps/files_reminders/lib/AppInfo/Application.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,7 @@ public function register(IRegistrationContext $context): void {
4242
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
4343

4444
$context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
45+
46+
$context->registerSetupCheck(NeedNotificationsApp::class);
4547
}
4648
}

apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public function handle(Event $event): void {
3131
}
3232

3333
if (!$this->appManager->isEnabledForUser('notifications')) {
34-
$this->logger->info('Skipped registering the `files_reminders` app because the `notifications` app is disabled.', ['app' => 'files_reminders']);
3534
return;
3635
}
3736

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\DAV\SetupChecks;
11+
12+
use OCP\App\IAppManager;
13+
use OCP\SetupCheck\ISetupCheck;
14+
use OCP\SetupCheck\SetupResult;
15+
16+
class NeedNotificationsApp implements ISetupCheck {
17+
public function __construct(
18+
private IAppManager $appManager,
19+
) {
20+
}
21+
22+
public function getName(): string {
23+
return $this->l10n->t('Files reminder');
24+
}
25+
26+
public function getCategory(): string {
27+
return 'system';
28+
}
29+
30+
public function run(): SetupResult {
31+
if ($this->appManager->isInstalled('notifications')) {
32+
return SetupResult::success($this->l10n->t('This files_reminder can work properly.'));
33+
} else {
34+
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.'));
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)