Skip to content
Open
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
1 change: 1 addition & 0 deletions apps/dav/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@
'OCA\\DAV\\Migration\\Version1031Date20240610134258' => $baseDir . '/../lib/Migration/Version1031Date20240610134258.php',
'OCA\\DAV\\Migration\\Version1034Date20250605132605' => $baseDir . '/../lib/Migration/Version1034Date20250605132605.php',
'OCA\\DAV\\Migration\\Version1034Date20250813093701' => $baseDir . '/../lib/Migration/Version1034Date20250813093701.php',
'OCA\\DAV\\Migration\\Version1035Date20260302000000' => $baseDir . '/../lib/Migration/Version1035Date20260302000000.php',
'OCA\\DAV\\Migration\\Version1036Date20251202000000' => $baseDir . '/../lib/Migration/Version1036Date20251202000000.php',
'OCA\\DAV\\Model\\ExampleEvent' => $baseDir . '/../lib/Model/ExampleEvent.php',
'OCA\\DAV\\Paginate\\LimitedCopyIterator' => $baseDir . '/../lib/Paginate/LimitedCopyIterator.php',
Expand Down
1 change: 1 addition & 0 deletions apps/dav/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ class ComposerStaticInitDAV
'OCA\\DAV\\Migration\\Version1031Date20240610134258' => __DIR__ . '/..' . '/../lib/Migration/Version1031Date20240610134258.php',
'OCA\\DAV\\Migration\\Version1034Date20250605132605' => __DIR__ . '/..' . '/../lib/Migration/Version1034Date20250605132605.php',
'OCA\\DAV\\Migration\\Version1034Date20250813093701' => __DIR__ . '/..' . '/../lib/Migration/Version1034Date20250813093701.php',
'OCA\\DAV\\Migration\\Version1035Date20260302000000' => __DIR__ . '/..' . '/../lib/Migration/Version1035Date20260302000000.php',
'OCA\\DAV\\Migration\\Version1036Date20251202000000' => __DIR__ . '/..' . '/../lib/Migration/Version1036Date20251202000000.php',
'OCA\\DAV\\Model\\ExampleEvent' => __DIR__ . '/..' . '/../lib/Model/ExampleEvent.php',
'OCA\\DAV\\Paginate\\LimitedCopyIterator' => __DIR__ . '/..' . '/../lib/Paginate/LimitedCopyIterator.php',
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'],
'{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'],
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int'],
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}default-alarm' => ['default_alarm', 'string'],
];

/**
Expand Down
39 changes: 39 additions & 0 deletions apps/dav/lib/Migration/Version1037Date20260302000000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\DAV\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

#[AddColumn(table: 'calendars', name: 'default_alarm', type: ColumnType::STRING)]
class Version1037Date20260302000000 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

$calendarsTable = $schema->getTable('calendars');

if (!$calendarsTable->hasColumn('default_alarm')) {
$calendarsTable->addColumn('default_alarm', Types::INTEGER, [
'notnull' => false,
'length' => 10,
'default' => null,
]);
}

return $schema;
}
}

39 changes: 39 additions & 0 deletions apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1881,4 +1881,43 @@ public function testUnshare(): void {
);

}

public function testDefaultAlarmProperty(): void {
$calendarId = $this->createTestCalendar();

// Test setting default alarm property to 15 minutes before (-900 seconds)
$patch = new PropPatch([
'{http://nextcloud.com/ns}default-alarm' => '-900'
]);
$this->backend->updateCalendar($calendarId, $patch);
$patch->commit();

// Verify the property was set
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
$this->assertCount(1, $calendars);
$this->assertEquals('-900', $calendars[0]['{http://nextcloud.com/ns}default-alarm']);

// Test updating to a different value (1 day before = -86400 seconds)
$patch = new PropPatch([
'{http://nextcloud.com/ns}default-alarm' => '-86400'
]);
$this->backend->updateCalendar($calendarId, $patch);
$patch->commit();

$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
$this->assertEquals('-86400', $calendars[0]['{http://nextcloud.com/ns}default-alarm']);

// Test setting to "none"
$patch = new PropPatch([
'{http://nextcloud.com/ns}default-alarm' => 'none'
]);
$this->backend->updateCalendar($calendarId, $patch);
$patch->commit();

$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
$this->assertEquals('none', $calendars[0]['{http://nextcloud.com/ns}default-alarm']);

// Clean up
$this->backend->deleteCalendar($calendars[0]['id'], true);
}
}
Loading