Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Still push notifications of twofactor_nextcloud_notification when in DND
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Nov 4, 2022
commit 7a8a862d49869577bd4e807ec371775efa6069d4
10 changes: 9 additions & 1 deletion lib/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -226,7 +234,7 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf

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;
}
Expand Down