diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index f64a7a6bc..db121ea82 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -139,6 +139,10 @@ class CalendarController extends AbstractController */ public function editAction(Calendar $entity, Request $request): Response { + if (!$this->remoteCalendarConnector->isReady()) { + return $this->remoteCalendarConnector->getMakeReadyResponse($request->getUri()); + } + $view = null; $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index 65c7d1320..987862195 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -81,10 +81,8 @@ class CalendarType extends AbstractType 'expanded' => true, ]); - if ($options['data'] instanceof Calendar && $options['data']->getId() === null) { - $builder->add('mainUser', HiddenType::class); - $builder->get('mainUser')->addModelTransformer($this->idToUserDataTransformer); - } + $builder->add('mainUser', HiddenType::class); + $builder->get('mainUser')->addModelTransformer($this->idToUserDataTransformer); $builder->add('startDate', HiddenType::class); $builder->get('startDate') diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 7eb1b7c55..caca3cecb 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -99,16 +99,18 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface $ids = array_map(function ($item) { return $item['id']; }, $bareEvents['value']); $existingIdsInRange = $this->calendarRangeRepository->findRemoteIdsPresent($ids); - return array_map( - function ($item) { - return $this->remoteEventConverter->convertToRemote($item); - }, - // filter all event to keep only the one not in range - array_filter( - $bareEvents['value'], - function ($item) use ($existingIdsInRange) { - return (!$existingIdsInRange[$item['id']]) ?? true; - } + return array_values( + array_map( + function ($item) { + return $this->remoteEventConverter->convertToRemote($item); + }, + // filter all event to keep only the one not in range + array_filter( + $bareEvents['value'], + function ($item) use ($existingIdsInRange) { + return (!$existingIdsInRange[$item['id']]) ?? true; + } + ) ) ); } catch (ClientExceptionInterface $e) { diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/App.vue index 43d0020a9..d94718942 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/App.vue @@ -1,8 +1,34 @@