diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-06 11:25:36 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2024-03-07 22:40:30 +0100 |
commit | 26728846b40bb1819ad4de507f397b944d15877b (patch) | |
tree | 28eea14d3151fbff6a7f845096e99780fe0370e7 /apps/updatenotification/lib/BackgroundJob | |
parent | 40ae1295e6bd2414cf2716b79e2d4a74cb4bd2d5 (diff) | |
download | nextcloud-server-26728846b40bb1819ad4de507f397b944d15877b.tar.gz nextcloud-server-26728846b40bb1819ad4de507f397b944d15877b.zip |
feat(updatenotification): Allow to disable the app updated notifications and allow to en/disable guest users notification
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/updatenotification/lib/BackgroundJob')
-rw-r--r-- | apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php b/apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php index caeb5a8dfa9..11d6577e81b 100644 --- a/apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php +++ b/apps/updatenotification/lib/BackgroundJob/AppUpdatedNotifications.php @@ -28,6 +28,7 @@ namespace OCA\UpdateNotification\BackgroundJob; use OCA\UpdateNotification\AppInfo\Application; use OCA\UpdateNotification\Manager; use OCP\App\IAppManager; +use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\QueuedJob; use OCP\IConfig; @@ -41,6 +42,7 @@ class AppUpdatedNotifications extends QueuedJob { public function __construct( ITimeFactory $time, private IConfig $config, + private IAppConfig $appConfig, private IManager $notificationManager, private IUserManager $userManager, private IAppManager $appManager, @@ -98,13 +100,13 @@ class AppUpdatedNotifications extends QueuedJob { * Notify all users for which the updated app is enabled */ private function notifyUsers(string $appId, INotification $notification): void { - $guestsEnabled = class_exists('\OCA\Guests\UserBackend'); + $guestsEnabled = $this->appConfig->getAppValueBool('app_updated.notify_guests', false) && class_exists('\OCA\Guests\UserBackend'); $isDefer = $this->notificationManager->defer(); // Notify all seen users about the app update $this->userManager->callForSeenUsers(function (IUser $user) use ($guestsEnabled, $appId, $notification) { - if ($guestsEnabled && ($user->getBackend() instanceof ('\OCA\Guests\UserBackend'))) { + if (!$guestsEnabled && ($user->getBackendClassName() === '\OCA\Guests\UserBackend')) { return; } |