-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disable both iTip and iMip messages
Signed-off-by: SebastianKrupinski <[email protected]>
- Loading branch information
1 parent
863c880
commit d23f95e
Showing
4 changed files
with
73 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -997,23 +997,4 @@ public function testNoButtons(): void { | |
$this->plugin->schedule($message); | ||
$this->assertEquals('1.1', $message->getScheduleStatus()); | ||
} | ||
|
||
public function testImipDisabledForEvent(): void { | ||
// construct iTip message with event and attendees | ||
$calendar = new VCalendar(); | ||
$calendar->add('VEVENT', ['UID' => 'uid-1234']); | ||
$event = $calendar->VEVENT; | ||
$event->add('ORGANIZER', 'mailto:[email protected]'); | ||
$event->add('ATTENDEE', 'mailto:' . '[email protected]', ['RSVP' => 'TRUE', 'CN' => 'Frodo']); | ||
$event->add('X-NC-DISABLE-SCHEDULING', 'true'); | ||
$message = new Message(); | ||
$message->method = 'REQUEST'; | ||
$message->message = $calendar; | ||
$message->sender = 'mailto:[email protected]'; | ||
$message->senderName = 'Mr. Wizard'; | ||
$message->recipient = 'mailto:' . '[email protected]'; | ||
|
||
$this->plugin->schedule($message); | ||
$this->assertEquals('1.0;We got the message, but iMip messages are disabled for this event', $message->scheduleStatus); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
@@ -738,4 +739,64 @@ function (string $eventName, array $arguments = [], ?callable $continueCallBack | |
|
||
} | ||
|
||
/** | ||
* Test Calendar Event Creation with iTip and iMip disabled | ||
* | ||
* Should generate 2 messages for attendees User 2 and User External | ||
*/ | ||
public function testCalendarObjectChangeWithSchedulingDisabled(): void { | ||
// construct server request | ||
$request = new Request( | ||
'PUT', | ||
'/remote.php/dav/calendars/user1/personal/B0DC78AE-6DD7-47E3-80BE-89F23E6D5383.ics' | ||
); | ||
$request->setBaseUrl('/remote.php/dav/'); | ||
// construct server response | ||
$response = new Response(); | ||
// construct server tree | ||
$tree = $this->createMock(Tree::class); | ||
$tree->expects($this->never()) | ||
->method('getNodeForPath'); | ||
// construct server properties and returns | ||
$this->server->httpRequest = $request; | ||
$this->server->tree = $tree; | ||
// construct calendar with a 1 hour event and same start/end time zones | ||
$vCalendar = new VCalendar(); | ||
$vEvent = $vCalendar->add('VEVENT', []); | ||
$vEvent->UID->setValue('96a0e6b1-d886-4a55-a60d-152b31401dcc'); | ||
$vEvent->add('DTSTART', '20240701T080000', ['TZID' => 'America/Toronto']); | ||
$vEvent->add('DTEND', '20240701T090000', ['TZID' => 'America/Toronto']); | ||
$vEvent->add('SUMMARY', 'Test Recurring Event'); | ||
$vEvent->add('ORGANIZER', 'mailto:[email protected]', ['CN' => 'User One']); | ||
$vEvent->add('ATTENDEE', 'mailto:[email protected]', [ | ||
'CN' => 'User Two', | ||
'CUTYPE' => 'INDIVIDUAL', | ||
'PARTSTAT' => 'NEEDS-ACTION', | ||
'ROLE' => 'REQ-PARTICIPANT', | ||
'RSVP' => 'TRUE' | ||
]); | ||
$vEvent->add('ATTENDEE', 'mailto:[email protected]', [ | ||
'CN' => 'User External', | ||
'CUTYPE' => 'INDIVIDUAL', | ||
'PARTSTAT' => 'NEEDS-ACTION', | ||
'ROLE' => 'REQ-PARTICIPANT', | ||
'RSVP' => 'TRUE' | ||
]); | ||
$vEvent->add('X-NC-DISABLE-SCHEDULING', 'true'); | ||
// define flags | ||
$newFlag = true; | ||
$modifiedFlag = false; | ||
// execute method | ||
$this->plugin->calendarObjectChange( | ||
$request, | ||
$response, | ||
$vCalendar, | ||
'calendars/user1/personal', | ||
$modifiedFlag, | ||
$newFlag | ||
); | ||
// test if event was modified and property was removed | ||
$this->assertTrue($modifiedFlag); | ||
$this->assertFalse(isset($vCalendar->VEVENT->{'X-NC-DISABLE-SCHEDULING'})); | ||
} | ||
} |