summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-11-16 21:01:27 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-11-16 21:01:27 +0100
commite4568234a5c2e7f597d511e8fd1cbafa409bf29f (patch)
tree7fa138cbbb0ff6ac91fed66ff450448fb9d0756d /apps/dav
parenta0b649442cadec1f9b1d97bcd6b0c3e1289671d6 (diff)
downloadnextcloud-server-e4568234a5c2e7f597d511e8fd1cbafa409bf29f.tar.gz
nextcloud-server-e4568234a5c2e7f597d511e8fd1cbafa409bf29f.zip
Use uri as displayname
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/caldav/caldavbackend.php26
-rw-r--r--apps/dav/tests/unit/caldav/caldavbackendtest.php7
2 files changed, 13 insertions, 20 deletions
diff --git a/apps/dav/lib/caldav/caldavbackend.php b/apps/dav/lib/caldav/caldavbackend.php
index 19bbc6cb93d..08a2a70c56d 100644
--- a/apps/dav/lib/caldav/caldavbackend.php
+++ b/apps/dav/lib/caldav/caldavbackend.php
@@ -169,19 +169,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* @return void
*/
function createCalendar($principalUri, $calendarUri, array $properties) {
- $fieldNames = [
- 'principaluri',
- 'uri',
- 'synctoken',
- 'transparent',
- 'components'
- ];
$values = [
'principaluri' => $principalUri,
'uri' => $calendarUri,
'synctoken' => 1,
'transparent' => 0,
- 'components' => 'VEVENT,VTODO'
+ 'components' => 'VEVENT,VTODO',
+ 'displayname' => $calendarUri
];
// Default value
@@ -199,22 +193,16 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
foreach($this->propertyMap as $xmlName=>$dbName) {
if (isset($properties[$xmlName])) {
-
$values[$dbName] = $properties[$xmlName];
- $fieldNames[] = $dbName;
}
}
$query = $this->db->getQueryBuilder();
- $query->insert('calendars')
- ->values([
- 'principaluri' => $query->createNamedParameter($values['principaluri']),
- 'uri' => $query->createNamedParameter($values['uri']),
- 'synctoken' => $query->createNamedParameter($values['synctoken']),
- 'transparent' => $query->createNamedParameter($values['transparent']),
- 'components' => $query->createNamedParameter($values['components']),
- ])
- ->execute();
+ $query->insert('calendars');
+ foreach($values as $column => $value) {
+ $query->setValue($column, $query->createNamedParameter($value));
+ }
+ $query->execute();
}
/**
diff --git a/apps/dav/tests/unit/caldav/caldavbackendtest.php b/apps/dav/tests/unit/caldav/caldavbackendtest.php
index fdd76f90213..258c5627ad9 100644
--- a/apps/dav/tests/unit/caldav/caldavbackendtest.php
+++ b/apps/dav/tests/unit/caldav/caldavbackendtest.php
@@ -249,14 +249,19 @@ EOD;
}
private function createTestCalendar() {
- $this->backend->createCalendar(self::UNIT_TEST_USER, 'Example', []);
+ $this->backend->createCalendar(self::UNIT_TEST_USER, 'Example', [
+ '{http://apple.com/ns/ical/}calendar-color' => '#1C4587FF'
+ ]);
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
$this->assertEquals(1, count($calendars));
$this->assertEquals(self::UNIT_TEST_USER, $calendars[0]['principaluri']);
/** @var SupportedCalendarComponentSet $components */
$components = $calendars[0]['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'];
$this->assertEquals(['VEVENT','VTODO'], $components->getValue());
+ $color = $calendars[0]['{http://apple.com/ns/ical/}calendar-color'];
+ $this->assertEquals('#1C4587FF', $color);
$this->assertEquals('Example', $calendars[0]['uri']);
+ $this->assertEquals('Example', $calendars[0]['{DAV:}displayname']);
$calendarId = $calendars[0]['id'];
return $calendarId;