Merge pull request #37200 from nextcloud/backport/37167/stable25

[stable25] fix(dav): Handle no next potential toggle in availability detection
This commit is contained in:
Joas Schilling 2023-03-14 22:13:06 +01:00 committed by GitHub
commit ab6fdbe631
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);