diff options
author | Joas Schilling <coding@schilljs.com> | 2022-11-04 11:19:44 +0300 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2022-11-04 11:54:34 +0300 |
commit | 1a3f5dce72e99e2e999bf9b80d9e119fe81db31f (patch) | |
tree | d77688994f2517c7040e6ef684e5acf323ea9709 | |
parent | d60834b6434b128de392bc734d6ad757c1456c65 (diff) |
Still push notifications of twofactor_nextcloud_notification when in DND
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Push.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Push.php b/lib/Push.php index 94f7648..2204ecd 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -91,6 +91,14 @@ class Push { /** @var string[] */ protected $loadStatusForUsers = []; + /** + * A very small and privileged list of apps that are allowed to push during DND. + * @var bool[] + */ + protected $allowedDNDPushList = [ + 'twofactor_nextcloud_notification' => true, + ]; + public function __construct(IDBConnection $connection, INotificationManager $notificationManager, IConfig $config, @@ -226,7 +234,7 @@ class Push { if (isset($this->userStatuses[$notification->getUser()])) { $userStatus = $this->userStatuses[$notification->getUser()]; - if ($userStatus->getStatus() === IUserStatus::DND) { + if ($userStatus->getStatus() === IUserStatus::DND && empty($this->allowedDNDPushList[$notification->getApp()])) { $this->printInfo('<error>User status is set to DND - no push notifications will be sent</error>'); return; } |