Skip to content

Commit

Permalink
Merge pull request #695 from phil-davis/fix-status-cancelled-4.5
Browse files Browse the repository at this point in the history
[4.5] fix: check if event status was changed to cancelled and generate appr…
  • Loading branch information
phil-davis authored Oct 14, 2024
2 parents fda12d4 + 7201ecf commit e8d649e
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/ITip/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,11 @@ protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo,
$icalMsg->add(clone $timezone);
}

if (!$attendee['newInstances']) {
// If there are no instances the attendee is a part of, it
// means the attendee was removed and we need to send him a
// CANCEL.
if (!$attendee['newInstances'] || 'CANCELLED' === $eventInfo['status']) {
// If there are no instances the attendee is a part of, it means
// the attendee was removed and we need to send them a CANCEL message.
// Also If the meeting STATUS property was changed to CANCELLED
// we need to send the attendee a CANCEL message.
$message->method = 'CANCEL';

$icalMsg->METHOD = $message->method;
Expand Down
62 changes: 62 additions & 0 deletions tests/VObject/ITip/BrokerUpdateEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -814,4 +814,66 @@ public function testInviteChangeExdateOrder()

$this->parse($oldMessage, $newMessage, $expected, 'mailto:[email protected]');
}

public function testInviteStatusCancelled(): void
{
$oldMessage = <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
SEQUENCE:2
ORGANIZER;CN=Strunk:mailto:[email protected]
ATTENDEE;CN=One:mailto:[email protected]
DTSTART:20140716T120000Z
DTEND:20140716T130000Z
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
ICS;

$newMessage = <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:foobar
SEQUENCE:3
ORGANIZER;CN=Strunk:mailto:[email protected]
ATTENDEE;CN=One:mailto:[email protected]
DTSTART:20140716T120000Z
DTEND:20140716T130000Z
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR
ICS;

$version = \Sabre\VObject\Version::VERSION;

$expected = [
[
'uid' => 'foobar',
'method' => 'CANCEL',
'component' => 'VEVENT',
'message' => <<<ICS
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Sabre//Sabre VObject $version//EN
CALSCALE:GREGORIAN
METHOD:CANCEL
BEGIN:VEVENT
UID:foobar
DTSTAMP:**ANY**
SEQUENCE:3
DTSTART:20140716T120000Z
DTEND:20140716T130000Z
ORGANIZER;CN=Strunk:mailto:[email protected]
ATTENDEE;CN=One:mailto:[email protected]
END:VEVENT
END:VCALENDAR
ICS
],
];

$this->parse($oldMessage, $newMessage, $expected, 'mailto:[email protected]');
}
}

0 comments on commit e8d649e

Please sign in to comment.