Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions lib/ITip/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,25 @@ public function parseEvent($calendar, $userHref, $oldCalendar = null): array

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.
} else {
// We need to figure out if the user is an attendee. If
// that is the case, we want to process that attendee if
// there is also an oldcalendar or if some of the
// instances of that attendee has partstat different from
// NEEDS-ACTION. See
// https://github.com/sabre-io/vobject/issues/719
foreach ($eventInfo['attendees'] as $attendee) {
if (in_array($attendee['href'], $userHref)) {
return $this->parseEventForAttendee($baseCalendar, $eventInfo, $oldEventInfo, $attendee['href']);
$isPartstatDefined = false;
foreach ($attendee['instances'] as $instance) {
if ('NEEDS-ACTION' != $instance['partstat']) {
$isPartstatDefined = true;
break;
}
}
if ($oldCalendar or $isPartstatDefined) {
return $this->parseEventForAttendee($baseCalendar, $eventInfo, $oldEventInfo, $attendee['href']);
}
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions tests/VObject/Component/VAvailabilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,7 @@ protected function template(array $properties)
END:VAVAILABILITY
END:VCALENDAR
VCAL
,
VCAL,
$properties
);
}
Expand All @@ -459,8 +458,7 @@ protected function templateAvailable(array $properties)
END:AVAILABLE
END:VAVAILABILITY
END:VCALENDAR
VCAL
,
VCAL,
$properties
);
}
Expand Down
22 changes: 9 additions & 13 deletions tests/VObject/ITip/BrokerAttendeeReplyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@ class BrokerAttendeeReplyTest extends BrokerTester
{
public function testAccepted(): void
{
$oldMessage = <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
SUMMARY:B-day party
SEQUENCE:1
ORGANIZER;CN=Strunk:mailto:strunk@example.org
ATTENDEE;CN=One:mailto:one@example.org
DTSTART:20140716T120000Z
END:VEVENT
END:VCALENDAR
ICS;
// If $oldMessage is not set, in some cases an iTip message
// still needs to be generated; this happens when partstat
// differs from NEEDS-ACTION. For example, this is relevant in
// cases where a CalDAV client has received a calendar invite
// in some way, and the user of the client accepts
// participation before the upload. Also see
// https://github.com/sabre-io/vobject/issues/719

$oldMessage = '';

$newMessage = <<<ICS
BEGIN:VCALENDAR
Expand Down
Loading