Skip to content

Commit 83a5d11

Browse files
kristoffermollerhojphil-davis
authored andcommitted
Fixed cornercase for recurrent event for organizer and no attendee
1 parent 2bc58e2 commit 83a5d11

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

lib/ITip/Broker.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo,
499499
}
500500

501501
$messages = [];
502-
503502
foreach ($attendees as $attendee) {
504503
// An organizer can also be an attendee. We should not generate any
505504
// messages for those.
@@ -916,6 +915,9 @@ protected function parseEventInfo(?VCalendar $calendar = null)
916915
$timezone = $vevent->{'RECURRENCE-ID'}->getDateTime()->getTimeZone();
917916
}
918917
}
918+
919+
$instances[$recurId] = $vevent;
920+
919921
if (isset($vevent->ATTENDEE)) {
920922
foreach ($vevent->ATTENDEE as $attendee) {
921923
if ($this->scheduleAgentServerRules &&
@@ -954,7 +956,6 @@ protected function parseEventInfo(?VCalendar $calendar = null)
954956
];
955957
}
956958
}
957-
$instances[$recurId] = $vevent;
958959
}
959960

960961
foreach ($this->significantChangeProperties as $prop) {

tests/VObject/ITip/BrokerNewEventTest.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,4 +575,60 @@ public function testNoOrganizerHasAttendee()
575575

576576
$this->parse(null, $message, [], 'mailto:strunk@example.org');
577577
}
578+
579+
public function testAttendeeRemoval(): void
580+
{
581+
$message = <<<ICS
582+
BEGIN:VCALENDAR
583+
VERSION:2.0
584+
BEGIN:VEVENT
585+
UID:foobar
586+
RRULE:FREQ=DAILY
587+
DTSTART:20140811T220000Z
588+
DTEND:20140811T230000Z
589+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
590+
ATTENDEE;CN=White:mailto:white@example.org
591+
END:VEVENT
592+
BEGIN:VEVENT
593+
UID:foobar
594+
RECURRENCE-ID:20140812T220000Z
595+
DTSTART:20140812T220000Z
596+
DTEND:20140812T230000Z
597+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
598+
END:VEVENT
599+
END:VCALENDAR
600+
ICS;
601+
602+
$expectedMessage = <<<ICS
603+
BEGIN:VCALENDAR
604+
VERSION:2.0
605+
METHOD:REQUEST
606+
BEGIN:VEVENT
607+
UID:foobar
608+
RRULE:FREQ=DAILY
609+
DTSTART:20140811T220000Z
610+
DTEND:20140811T230000Z
611+
ORGANIZER;CN=Strunk:mailto:strunk@example.org
612+
ATTENDEE;CN=White;PARTSTAT=NEEDS-ACTION:mailto:white@example.org
613+
EXDATE:20140812T220000Z
614+
DTSTAMP:**ANY**
615+
END:VEVENT
616+
END:VCALENDAR
617+
ICS;
618+
619+
$expected = [
620+
[
621+
'uid' => 'foobar',
622+
'method' => 'REQUEST',
623+
'component' => 'VEVENT',
624+
'sender' => 'mailto:strunk@example.org',
625+
'senderName' => 'Strunk',
626+
'recipient' => 'mailto:white@example.org',
627+
'recipientName' => 'White',
628+
'message' => $expectedMessage,
629+
],
630+
];
631+
632+
$this->parse(null, $message, $expected, 'mailto:strunk@example.org');
633+
}
578634
}

0 commit comments

Comments
 (0)