From b103d803b191f89a5c5489ccfdb3c3258ca513b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Sat, 3 Aug 2024 18:05:05 +0200 Subject: [PATCH] feat: calendar name --- src/Controller/WatchListController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Controller/WatchListController.php b/src/Controller/WatchListController.php index ee1e074..ca1211a 100644 --- a/src/Controller/WatchListController.php +++ b/src/Controller/WatchListController.php @@ -19,6 +19,8 @@ use Eluceo\iCal\Domain\ValueObject\Date; use Eluceo\iCal\Domain\ValueObject\EmailAddress; use Eluceo\iCal\Domain\ValueObject\SingleDay; use Eluceo\iCal\Domain\ValueObject\Timestamp; +use Eluceo\iCal\Presentation\Component\Property; +use Eluceo\iCal\Presentation\Component\Property\Value\TextValue; use Eluceo\iCal\Presentation\Factory\CalendarFactory; use Sabre\VObject\EofException; use Sabre\VObject\InvalidDataException; @@ -114,7 +116,13 @@ class WatchListController extends AbstractController } } - return new Response((new CalendarFactory())->createCalendar($calendar), Response::HTTP_OK, [ + $calendarResponse = (new CalendarFactory())->createCalendar($calendar); + $calendarName = $watchList->getName(); + if (null !== $calendarName) { + $calendarResponse->withProperty(new Property('X-WR-CALNAME', new TextValue($calendarName))); + } + + return new Response($calendarResponse, Response::HTTP_OK, [ 'Content-Type' => 'text/calendar; charset=utf-8', ]); }