mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-17 21:12:16 +01:00
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>
This commit is contained in:
parent
d077a3174a
commit
263a8cf562
3 changed files with 21 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue