Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/integration.yml2
-rw-r--r--.github/workflows/phpunit.yml2
-rw-r--r--lib/Push.php10
3 files changed, 11 insertions, 3 deletions
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index 2a4bee5..530f516 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -149,7 +149,7 @@ jobs:
services:
postgres:
- image: postgres
+ image: postgres:14
ports:
- 4444:5432/tcp
env:
diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml
index 2ecabb5..8c59982 100644
--- a/.github/workflows/phpunit.yml
+++ b/.github/workflows/phpunit.yml
@@ -147,7 +147,7 @@ jobs:
services:
postgres:
- image: postgres
+ image: postgres:14
ports:
- 4444:5432/tcp
env:
diff --git a/lib/Push.php b/lib/Push.php
index a6ef570..c985205 100644
--- a/lib/Push.php
+++ b/lib/Push.php
@@ -77,6 +77,14 @@ class Push {
/** @var bool */
protected $deferPayloads = false;
+ /**
+ * 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,
@@ -169,7 +177,7 @@ class Push {
if (isset($userStatus[$notification->getUser()])) {
$userStatus = $userStatus[$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;
}