Commit e4568234 authored by Thomas Müller's avatar Thomas Müller
Browse files

Use uri as displayname

parent a0b64944
......@@ -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();
}
/**
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment