Skip to content

Commit 4bf2c58

Browse files
kristoffermollerhojphil-davis
authored andcommitted
Fixed cornercase for recurrent event for organizer and no attendee
1 parent 8b28880 commit 4bf2c58

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
@@ -479,7 +479,6 @@ protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo,
479479
}
480480

481481
$messages = [];
482-
483482
foreach ($attendees as $attendee) {
484483
// An organizer can also be an attendee. We should not generate any
485484
// messages for those.
@@ -895,6 +894,9 @@ protected function parseEventInfo(VCalendar $calendar): array
895894
$timezone = $vevent->{'RECURRENCE-ID'}->getDateTime()->getTimeZone();
896895
}
897896
}
897+
898+
$instances[$recurId] = $vevent;
899+
898900
if (isset($vevent->ATTENDEE)) {
899901
foreach ($vevent->ATTENDEE as $attendee) {
900902
if ($this->scheduleAgentServerRules
@@ -933,7 +935,6 @@ protected function parseEventInfo(VCalendar $calendar): array
933935
];
934936
}
935937
}
936-
$instances[$recurId] = $vevent;
937938
}
938939

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

tests/VObject/ITip/BrokerNewEventTest.php

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

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

0 commit comments

Comments
 (0)