From 4647f615ac01ee82298f6f79e4efda30fb2fc326 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Tue, 30 Dec 2025 13:48:29 -0500 Subject: [PATCH 1/3] fix: send participation reply on fresh event Signed-off-by: SebastianKrupinski --- lib/ITip/Broker.php | 25 ++++++--- .../VObject/ITip/BrokerAttendeeReplyTest.php | 52 +++++++++++++++++++ 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php index 6f0b1ed2f..fc3db753c 100644 --- a/lib/ITip/Broker.php +++ b/lib/ITip/Broker.php @@ -240,16 +240,29 @@ public function parseEvent($calendar, $userHref, $oldCalendar = null) $baseCalendar = $oldCalendar; } + // Check if the user is the organizer if (in_array($eventInfo['organizer'], $userHref)) { return $this->parseEventForOrganizer($baseCalendar, $eventInfo, $oldEventInfo); - } elseif ($oldCalendar) { - // We need to figure out if the user is an attendee, but we're only - // doing so if there's an oldCalendar, because we only want to - // process updates, not creation of new events. - foreach ($eventInfo['attendees'] as $attendee) { - if (in_array($attendee['href'], $userHref)) { + } + + // Check if the user is an attendee + foreach ($eventInfo['attendees'] as $attendee) { + if (in_array($attendee['href'], $userHref)) { + // If this is a event update, we always generate a reply + if ($oldCalendar) { return $this->parseEventForAttendee($baseCalendar, $eventInfo, $oldEventInfo, $attendee['href']); } + + // If this is a new event, we only generate a reply if the participation status is set + foreach ($attendee['instances'] as $instance) { + if (isset($instance['partstat']) && 'NEEDS-ACTION' !== $instance['partstat']) { + // Attendee has responded (ACCEPTED/DECLINED/TENTATIVE) - generate REPLY + return $this->parseEventForAttendee($baseCalendar, $eventInfo, $oldEventInfo, $attendee['href']); + } + } + + // User is attendee but no response to process + break; } }