From 263a8cf562dcfd416e9b6b93c869ee3bb4d68767 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 16 Dec 2025 19:12:48 -0300 Subject: [PATCH] fix: allow notifications when Activity setting is not registered When Activity app doesn't know about LibreSign's notification settings (common in test environments or fresh installations), we should allow notifications by default instead of blocking them. This fix checks if the Activity manager has the setting registered before enforcing the admin setting. If the setting is not found, notifications are allowed, respecting LibreSign's isDefaultEnabledMail() and isDefaultEnabledNotification() which return true. Fixes email and notification delivery in integration tests. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Controller/IdentifyAccountController.php | 7 +++++++ lib/Listener/MailNotifyListener.php | 7 +++++++ lib/Listener/NotificationListener.php | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/lib/Controller/IdentifyAccountController.php b/lib/Controller/IdentifyAccountController.php index 4dff5d32a..620bc78b8 100644 --- a/lib/Controller/IdentifyAccountController.php +++ b/lib/Controller/IdentifyAccountController.php @@ -279,6 +279,13 @@ class IdentifyAccountController extends AEnvironmentAwareController { } $activityUserSettings = \OCP\Server::get(\OCA\Activity\UserSettings::class); if ($activityUserSettings) { + $manager = \OCP\Server::get(\OCP\Activity\IManager::class); + try { + $manager->getSettingById($type); + } catch (\Exception $e) { + return false; + } + $adminSetting = $activityUserSettings->getAdminSetting('email', $type); if (!$adminSetting) { return true; diff --git a/lib/Listener/MailNotifyListener.php b/lib/Listener/MailNotifyListener.php index df529cfde..a9bfb7c81 100644 --- a/lib/Listener/MailNotifyListener.php +++ b/lib/Listener/MailNotifyListener.php @@ -174,6 +174,13 @@ class MailNotifyListener implements IEventListener { } $activityUserSettings = \OCP\Server::get(\OCA\Activity\UserSettings::class); if ($activityUserSettings) { + $manager = \OCP\Server::get(\OCP\Activity\IManager::class); + try { + $manager->getSettingById($type); + } catch (\Exception $e) { + return false; + } + $adminSetting = $activityUserSettings->getAdminSetting('email', $type); if (!$adminSetting) { return true; diff --git a/lib/Listener/NotificationListener.php b/lib/Listener/NotificationListener.php index a3ceecb7f..f9cc705e2 100644 --- a/lib/Listener/NotificationListener.php +++ b/lib/Listener/NotificationListener.php @@ -210,6 +210,13 @@ class NotificationListener implements IEventListener { } $activityUserSettings = \OCP\Server::get(\OCA\Activity\UserSettings::class); if ($activityUserSettings) { + $manager = \OCP\Server::get(\OCP\Activity\IManager::class); + try { + $manager->getSettingById($type); + } catch (\Exception $e) { + return false; + } + $adminSetting = $activityUserSettings->getAdminSetting('notification', $type); if (!$adminSetting) { return true;