Skip to content

Commit fd1656a

Browse files
miaulalalabackportbot[bot]
authored andcommitted
fix(caldav): allow renaming of birthday calendars
Signed-off-by: Anna Larch <[email protected]>
1 parent b8adb8b commit fd1656a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

apps/dav/lib/CalDAV/Calendar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10
4646

4747
parent::__construct($caldavBackend, $calendarInfo);
4848

49-
if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) {
49+
if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI && strcasecmp($this->calendarInfo['{DAV:}displayname'], 'Contact birthdays') === 0) {
5050
$this->calendarInfo['{DAV:}displayname'] = $l10n->t('Contact birthdays');
5151
}
5252
if ($this->getName() === CalDavBackend::PERSONAL_CALENDAR_URI &&

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public function testDeleteBirthdayCalendar(): void {
113113
'principaluri' => 'principals/users/user1',
114114
'id' => 666,
115115
'uri' => 'contact_birthdays',
116+
'{DAV:}displayname' => 'Test',
116117
];
117118

118119
$c = new Calendar($backend, $calendarInfo, $this->l10n, $this->config, $this->logger);
@@ -182,6 +183,7 @@ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'def
182183
'id' => 666,
183184
'uri' => $uri
184185
];
186+
$calendarInfo['{DAV:}displayname'] = 'Test';
185187
if (!is_null($readOnlyValue)) {
186188
$calendarInfo['{http://owncloud.org/ns}read-only'] = $readOnlyValue;
187189
}

apps/dav/tests/unit/Command/DeleteCalendarTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function testDelete(): void {
126126
$calendar = [
127127
'id' => $id,
128128
'principaluri' => 'principals/users/' . self::USER,
129-
'uri' => self::NAME
129+
'uri' => self::NAME,
130130
];
131131

132132
$this->userManager->expects($this->once())
@@ -187,7 +187,8 @@ public function testDeleteBirthday(): void {
187187
$calendar = [
188188
'id' => $id,
189189
'principaluri' => 'principals/users/' . self::USER,
190-
'uri' => BirthdayService::BIRTHDAY_CALENDAR_URI
190+
'uri' => BirthdayService::BIRTHDAY_CALENDAR_URI,
191+
'{DAV:}displayname' => 'Test',
191192
];
192193

193194
$this->userManager->expects($this->once())
@@ -216,7 +217,8 @@ public function testBirthdayHasPrecedence(): void {
216217
$calendar = [
217218
'id' => 1234,
218219
'principaluri' => 'principals/users/' . self::USER,
219-
'uri' => BirthdayService::BIRTHDAY_CALENDAR_URI
220+
'uri' => BirthdayService::BIRTHDAY_CALENDAR_URI,
221+
'{DAV:}displayname' => 'Test',
220222
];
221223
$this->userManager->expects($this->once())
222224
->method('userExists')

0 commit comments

Comments
 (0)