|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|