summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2023-03-10 09:40:36 +0100
committerThomas Citharel <tcit@tcit.fr>2023-03-10 12:18:13 +0100
commit5c5de0bac1bf1bc00c01707f1170446c6d895129 (patch)
tree005d14fceeb9950cd653ef09c975e9e832cb68c1 /apps
parent16b68fdb347f8b1f4851fa42f54e6fe2122ee861 (diff)
downloadnextcloud-server-5c5de0bac1bf1bc00c01707f1170446c6d895129.tar.gz
nextcloud-server-5c5de0bac1bf1bc00c01707f1170446c6d895129.zip
fix(dav): Handle no next potential toggle in availability detection
Fixes: min(): Array must contain at least one element at /var/www/nc/nextcloud/apps/dav/lib/BackgroundJob/UserStatusAutomation.php#142 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/BackgroundJob/UserStatusAutomation.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php
index 94feadcae93..8edc28c9a69 100644
--- a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php
+++ b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php
@@ -139,6 +139,13 @@ class UserStatusAutomation extends TimedJob {
}
}
+ if (empty($nextPotentialToggles)) {
+ $this->logger->info('Removing ' . self::class . ' background job for user "' . $userId . '" because the user has no valid availability rules set');
+ $this->jobList->remove(self::class, $argument);
+ $this->manager->revertUserStatus($userId, IUserStatus::MESSAGE_AVAILABILITY, IUserStatus::DND);
+ return;
+ }
+
$nextAutomaticToggle = min($nextPotentialToggles);
$this->setLastRunToNextToggleTime($userId, $nextAutomaticToggle - 1);