Merge pull request #37167 from nextcloud/dav/fix/availability

fix(dav): Handle no next potential toggle in availability detection
This commit is contained in:
Anna 2023-03-13 11:36:38 +01:00 committed by GitHub
commit 44f452d5cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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