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>
pull/37167/head
Thomas Citharel 1 year ago
parent 16b68fdb34
commit 5c5de0bac1
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

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

Loading…
Cancel
Save