Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fix(files_reminder): Replace error log by setup check
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge authored and backportbot[bot] committed Apr 1, 2025
commit 89da238b700ff89b029d0899a7be3ce1b57ff725
2 changes: 2 additions & 0 deletions apps/files_reminders/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
37 changes: 37 additions & 0 deletions apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\DAV\SetupChecks;

use OCP\App\IAppManager;
use OCP\SetupCheck\ISetupCheck;
use OCP\SetupCheck\SetupResult;

class NeedNotificationsApp implements ISetupCheck {
public function __construct(
private IAppManager $appManager,
) {
}

public function getName(): string {
return $this->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.'));
}
}
}
Loading