mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
calendar range: remove on remote after removal in the database
This commit is contained in:
@@ -106,6 +106,15 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void
|
||||
{
|
||||
if ('' === $remoteId) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->removeEvent($remoteId, $user);
|
||||
}
|
||||
|
||||
public function syncCalendarRange(CalendarRange $calendarRange): void
|
||||
{
|
||||
if ($calendarRange->hasRemoteId()) {
|
||||
@@ -200,6 +209,23 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
|
||||
);
|
||||
}
|
||||
|
||||
private function removeEvent($remoteId, User $user): void
|
||||
{
|
||||
$userId = $this->mapCalendarToUser->getUserId($user);
|
||||
|
||||
try {
|
||||
$this->machineHttpClient->request(
|
||||
'DELETE',
|
||||
'users/' . $userId . '/calendar/events/' . $remoteId
|
||||
);
|
||||
} catch (ClientExceptionInterface $e) {
|
||||
$this->logger->warning('could not remove event from calendar', [
|
||||
'event_remote_id' => $remoteId,
|
||||
'user_id' => $user->getId(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function updateRemoteCalendarRange(CalendarRange $calendarRange): void
|
||||
{
|
||||
$userId = $this->mapCalendarToUser->getUserId($calendarRange->getUser());
|
||||
|
Reference in New Issue
Block a user