When creating addressbooks, make sure the displayname is set

This commit is contained in:
Arthur Schiwon 2015-11-10 11:37:07 +01:00
parent bdd396aa3d
commit 06d1685e75
2 changed files with 8 additions and 1 deletions

View file

@ -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([

View file

@ -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([