Skip to content

Commit 0b9d43e

Browse files
GVodyanovSebastianKrupinski
authored andcommitted
feat: add default reminder setting caldav
Signed-off-by: Grigory Vodyanov <scratchx@gmx.com>
1 parent 78cfe37 commit 0b9d43e

File tree

6 files changed

+83
-3
lines changed

6 files changed

+83
-3
lines changed

apps/dav/appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<name>WebDAV</name>
1111
<summary>WebDAV endpoint</summary>
1212
<description>WebDAV endpoint</description>
13-
<version>1.37.0</version>
13+
<version>1.38.0</version>
1414
<licence>agpl</licence>
1515
<author>owncloud.org</author>
1616
<namespace>DAV</namespace>

apps/dav/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@
389389
'OCA\\DAV\\Migration\\Version1034Date20250605132605' => $baseDir . '/../lib/Migration/Version1034Date20250605132605.php',
390390
'OCA\\DAV\\Migration\\Version1034Date20250813093701' => $baseDir . '/../lib/Migration/Version1034Date20250813093701.php',
391391
'OCA\\DAV\\Migration\\Version1036Date20251202000000' => $baseDir . '/../lib/Migration/Version1036Date20251202000000.php',
392+
'OCA\\DAV\\Migration\\Version1038Date20260302000000' => $baseDir . '/../lib/Migration/Version1038Date20260302000000.php',
392393
'OCA\\DAV\\Model\\ExampleEvent' => $baseDir . '/../lib/Model/ExampleEvent.php',
393394
'OCA\\DAV\\Paginate\\LimitedCopyIterator' => $baseDir . '/../lib/Paginate/LimitedCopyIterator.php',
394395
'OCA\\DAV\\Paginate\\PaginateCache' => $baseDir . '/../lib/Paginate/PaginateCache.php',

apps/dav/composer/composer/autoload_static.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
class ComposerStaticInitDAV
88
{
99
public static $prefixLengthsPsr4 = array (
10-
'O' =>
10+
'O' =>
1111
array (
1212
'OCA\\DAV\\' => 8,
1313
),
1414
);
1515

1616
public static $prefixDirsPsr4 = array (
17-
'OCA\\DAV\\' =>
17+
'OCA\\DAV\\' =>
1818
array (
1919
0 => __DIR__ . '/..' . '/../lib',
2020
),
@@ -404,6 +404,7 @@ class ComposerStaticInitDAV
404404
'OCA\\DAV\\Migration\\Version1034Date20250605132605' => __DIR__ . '/..' . '/../lib/Migration/Version1034Date20250605132605.php',
405405
'OCA\\DAV\\Migration\\Version1034Date20250813093701' => __DIR__ . '/..' . '/../lib/Migration/Version1034Date20250813093701.php',
406406
'OCA\\DAV\\Migration\\Version1036Date20251202000000' => __DIR__ . '/..' . '/../lib/Migration/Version1036Date20251202000000.php',
407+
'OCA\\DAV\\Migration\\Version1038Date20260302000000' => __DIR__ . '/..' . '/../lib/Migration/Version1038Date20260302000000.php',
407408
'OCA\\DAV\\Model\\ExampleEvent' => __DIR__ . '/..' . '/../lib/Model/ExampleEvent.php',
408409
'OCA\\DAV\\Paginate\\LimitedCopyIterator' => __DIR__ . '/..' . '/../lib/Paginate/LimitedCopyIterator.php',
409410
'OCA\\DAV\\Paginate\\PaginateCache' => __DIR__ . '/..' . '/../lib/Paginate/PaginateCache.php',

apps/dav/lib/CalDAV/CalDavBackend.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
151151
'{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'],
152152
'{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'],
153153
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int'],
154+
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}default-alarm' => ['default_alarm', 'string'],
154155
];
155156

156157
/**
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\DAV\Migration;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\DB\Types;
15+
use OCP\Migration\Attributes\AddColumn;
16+
use OCP\Migration\Attributes\ColumnType;
17+
use OCP\Migration\IOutput;
18+
use OCP\Migration\SimpleMigrationStep;
19+
20+
#[AddColumn(table: 'calendars', name: 'default_alarm', type: ColumnType::STRING)]
21+
class Version1038Date20260302000000 extends SimpleMigrationStep {
22+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
23+
/** @var ISchemaWrapper $schema */
24+
$schema = $schemaClosure();
25+
26+
$calendarsTable = $schema->getTable('calendars');
27+
28+
if (!$calendarsTable->hasColumn('default_alarm')) {
29+
$calendarsTable->addColumn('default_alarm', Types::INTEGER, [
30+
'notnull' => false,
31+
'length' => 10,
32+
'default' => null,
33+
]);
34+
}
35+
36+
return $schema;
37+
}
38+
}

apps/dav/tests/unit/CalDAV/CalDavBackendTest.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,4 +1881,43 @@ public function testUnshare(): void {
18811881
);
18821882

18831883
}
1884+
1885+
public function testDefaultAlarmProperty(): void {
1886+
$calendarId = $this->createTestCalendar();
1887+
1888+
// Test setting default alarm property to 15 minutes before (-900 seconds)
1889+
$patch = new PropPatch([
1890+
'{http://nextcloud.com/ns}default-alarm' => '-900'
1891+
]);
1892+
$this->backend->updateCalendar($calendarId, $patch);
1893+
$patch->commit();
1894+
1895+
// Verify the property was set
1896+
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
1897+
$this->assertCount(1, $calendars);
1898+
$this->assertEquals('-900', $calendars[0]['{http://nextcloud.com/ns}default-alarm']);
1899+
1900+
// Test updating to a different value (1 day before = -86400 seconds)
1901+
$patch = new PropPatch([
1902+
'{http://nextcloud.com/ns}default-alarm' => '-86400'
1903+
]);
1904+
$this->backend->updateCalendar($calendarId, $patch);
1905+
$patch->commit();
1906+
1907+
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
1908+
$this->assertEquals('-86400', $calendars[0]['{http://nextcloud.com/ns}default-alarm']);
1909+
1910+
// Test setting to "none"
1911+
$patch = new PropPatch([
1912+
'{http://nextcloud.com/ns}default-alarm' => 'none'
1913+
]);
1914+
$this->backend->updateCalendar($calendarId, $patch);
1915+
$patch->commit();
1916+
1917+
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
1918+
$this->assertEquals('none', $calendars[0]['{http://nextcloud.com/ns}default-alarm']);
1919+
1920+
// Clean up
1921+
$this->backend->deleteCalendar($calendars[0]['id'], true);
1922+
}
18841923
}

0 commit comments

Comments
 (0)