Skip to content

Commit

Permalink
Merge pull request #47337 from nextcloud/backport/47332/stable29
Browse files Browse the repository at this point in the history
[stable29] fix(caldav): allow renaming of birthday calendars
  • Loading branch information
blizzz authored Sep 5, 2024
2 parents 33d6aac + 8f838b2 commit 3508522
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10

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

if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) {
if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI && strcasecmp($this->calendarInfo['{DAV:}displayname'], 'Contact birthdays') === 0) {
$this->calendarInfo['{DAV:}displayname'] = $l10n->t('Contact birthdays');
}
if ($this->getName() === CalDavBackend::PERSONAL_CALENDAR_URI &&
Expand Down
2 changes: 2 additions & 0 deletions apps/dav/tests/unit/CalDAV/CalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public function testDeleteBirthdayCalendar(): void {
'principaluri' => 'principals/users/user1',
'id' => 666,
'uri' => 'contact_birthdays',
'{DAV:}displayname' => 'Test',
];

$c = new Calendar($backend, $calendarInfo, $this->l10n, $this->config, $this->logger);
Expand Down Expand Up @@ -204,6 +205,7 @@ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet, $uri = 'def
'id' => 666,
'uri' => $uri
];
$calendarInfo['{DAV:}displayname'] = 'Test';
if (!is_null($readOnlyValue)) {
$calendarInfo['{http://owncloud.org/ns}read-only'] = $readOnlyValue;
}
Expand Down
8 changes: 5 additions & 3 deletions apps/dav/tests/unit/Command/DeleteCalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function testDelete(): void {
$calendar = [
'id' => $id,
'principaluri' => 'principals/users/' . self::USER,
'uri' => self::NAME
'uri' => self::NAME,
];

$this->userManager->expects($this->once())
Expand Down Expand Up @@ -203,7 +203,8 @@ public function testDeleteBirthday(): void {
$calendar = [
'id' => $id,
'principaluri' => 'principals/users/' . self::USER,
'uri' => BirthdayService::BIRTHDAY_CALENDAR_URI
'uri' => BirthdayService::BIRTHDAY_CALENDAR_URI,
'{DAV:}displayname' => 'Test',
];

$this->userManager->expects($this->once())
Expand Down Expand Up @@ -232,7 +233,8 @@ public function testBirthdayHasPrecedence(): void {
$calendar = [
'id' => 1234,
'principaluri' => 'principals/users/' . self::USER,
'uri' => BirthdayService::BIRTHDAY_CALENDAR_URI
'uri' => BirthdayService::BIRTHDAY_CALENDAR_URI,
'{DAV:}displayname' => 'Test',
];
$this->userManager->expects($this->once())
->method('userExists')
Expand Down

0 comments on commit 3508522

Please sign in to comment.