Browse Source
Merge pull request #47332 from nextcloud/fix/allow-renaming-of-birthday-calendars
fix(caldav): allow renaming of birthday calendars
pull/47342/head
Anna
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
8 additions and
4 deletions
-
apps/dav/lib/CalDAV/Calendar.php
-
apps/dav/tests/unit/CalDAV/CalendarTest.php
-
apps/dav/tests/unit/Command/DeleteCalendarTest.php
|
|
|
@ -46,7 +46,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable |
|
|
|
|
|
|
|
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 && |
|
|
|
|
|
|
|
@ -113,6 +113,7 @@ class CalendarTest extends TestCase { |
|
|
|
'principaluri' => 'principals/users/user1', |
|
|
|
'id' => 666, |
|
|
|
'uri' => 'contact_birthdays', |
|
|
|
'{DAV:}displayname' => 'Test', |
|
|
|
]; |
|
|
|
|
|
|
|
$c = new Calendar($backend, $calendarInfo, $this->l10n, $this->config, $this->logger); |
|
|
|
@ -182,6 +183,7 @@ class CalendarTest extends TestCase { |
|
|
|
'id' => 666, |
|
|
|
'uri' => $uri |
|
|
|
]; |
|
|
|
$calendarInfo['{DAV:}displayname'] = 'Test'; |
|
|
|
if (!is_null($readOnlyValue)) { |
|
|
|
$calendarInfo['{http://owncloud.org/ns}read-only'] = $readOnlyValue; |
|
|
|
} |
|
|
|
|
|
|
|
@ -126,7 +126,7 @@ class DeleteCalendarTest extends TestCase { |
|
|
|
$calendar = [ |
|
|
|
'id' => $id, |
|
|
|
'principaluri' => 'principals/users/' . self::USER, |
|
|
|
'uri' => self::NAME |
|
|
|
'uri' => self::NAME, |
|
|
|
]; |
|
|
|
|
|
|
|
$this->userManager->expects($this->once()) |
|
|
|
@ -187,7 +187,8 @@ class DeleteCalendarTest extends TestCase { |
|
|
|
$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()) |
|
|
|
@ -216,7 +217,8 @@ class DeleteCalendarTest extends TestCase { |
|
|
|
$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') |
|
|
|
|