Skip to content
Merged
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
8 changes: 8 additions & 0 deletions apps/dav/lib/CalDAV/Reminder/ReminderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ private function onCalendarObjectCreate(array $objectData):void {
foreach($recurrenceExceptions as $recurrenceException) {
$eventHash = $this->getEventHash($recurrenceException);

if (!isset($recurrenceException->VALARM)) {
continue;
}

foreach($recurrenceException->VALARM as $valarm) {
/** @var VAlarm $valarm */
$alarmHash = $this->getAlarmHash($valarm);
Expand All @@ -216,6 +220,10 @@ private function onCalendarObjectCreate(array $objectData):void {
$masterAlarms = [];
$masterHash = $this->getEventHash($masterItem);

if (!isset($masterItem->VALARM)) {
return;
}

foreach($masterItem->VALARM as $valarm) {
$masterAlarms[] = $this->getAlarmHash($valarm);
}
Expand Down
32 changes: 32 additions & 0 deletions apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,23 @@ class ReminderServiceTest extends TestCase {
END:VALARM
END:VEVENT
END:VCALENDAR
EOD;

public const CALENDAR_DATA_NO_ALARM = <<<EOD
BEGIN:VCALENDAR
PRODID:-//Nextcloud calendar v1.6.4
BEGIN:VEVENT
CREATED:20160602T133732
DTSTAMP:20160602T133732
LAST-MODIFIED:20160602T133732
UID:wej2z68l9h
SUMMARY:Test Event
LOCATION:Somewhere ...
DESCRIPTION:maybe ....
DTSTART;TZID=Europe/Berlin;VALUE=DATE:20160609
DTEND;TZID=Europe/Berlin;VALUE=DATE:20160610
END:VEVENT
END:VCALENDAR
EOD;

public function setUp() {
Expand Down Expand Up @@ -278,6 +295,21 @@ public function testOnCalendarObjectCreateRecurringEntry(): void {
$this->reminderService->onTouchCalendarObject($action, $objectData);
}

public function testOnCalendarObjectCreateEmpty():void {
$action = '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject';
$objectData = [
'calendardata' => self::CALENDAR_DATA_NO_ALARM,
'id' => '42',
'calendarid' => '1337',
'component' => 'vevent',
];

$this->backend->expects($this->never())
->method('insertReminder');

$this->reminderService->onTouchCalendarObject($action, $objectData);
}

public function testOnCalendarObjectCreateRecurringEntryWithRepeat():void {
$action = '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject';
$objectData = [
Expand Down