Skip to content
Snippets Groups Projects
Commit 06d1685e authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

When creating addressbooks, make sure the displayname is set

parent bdd396aa
No related branches found
No related tags found
No related merge requests found
......@@ -134,7 +134,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
* @param string $principalUri
* @param string $url Just the 'basename' of the url.
* @param array $properties
* @return void
* @throws BadRequest
*/
function createAddressBook($principalUri, $url, array $properties) {
$values = [
......@@ -160,6 +160,12 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}
// Fallback to make sure the displayname is set. Some clients may refuse
// to work with addressbooks not having a displayname.
if(is_null($values['displayname'])) {
$values['displayname'] = $url;
}
$query = $this->db->getQueryBuilder();
$query->insert('addressbooks')
->values([
......
......@@ -60,6 +60,7 @@ class CardDavBackendTest extends TestCase {
$books = $this->backend->getAddressBooksForUser(self::UNIT_TEST_USER);
$this->assertEquals(1, count($books));
$this->assertEquals('Example', $books[0]['{DAV:}displayname']);
// update it's display name
$patch = new PropPatch([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment