Skip to content

Commit 556aa6b

Browse files
committed
fixup! enh(contacts): show/hide addressbooks for all
1 parent 01eae01 commit 556aa6b

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

apps/dav/lib/CardDAV/AddressBook.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,11 @@ public function delete() {
226226
}
227227

228228
public function propPatch(PropPatch $propPatch) {
229-
parent::propPatch($propPatch);
229+
// parent::propPatch will only update address books table
230+
// if address book is shared, changes have to be made to the properties table
231+
if (!$this->isShared()) {
232+
parent::propPatch($propPatch);
233+
}
230234
}
231235

232236
public function getContactsGroups() {

apps/dav/lib/DAV/CustomPropertiesBackend.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,21 @@ public function propFind($path, PropFind $propFind) {
176176
}
177177
}
178178

179+
// substr of addressbooks/ => path is inside the CardDAV component
180+
// three '/' => this a addressbook (no addressbook-home nor contact object)
181+
if (substr($path, 0, 13) === 'addressbooks/' && substr_count($path, '/') === 3) {
182+
$allRequestedProps = $propFind->getRequestedProperties();
183+
$customPropertiesForShares = [
184+
'{DAV:}displayname',
185+
];
186+
187+
foreach ($customPropertiesForShares as $customPropertyForShares) {
188+
if (in_array($customPropertyForShares, $allRequestedProps)) {
189+
$requestedProps[] = $customPropertyForShares;
190+
}
191+
}
192+
}
193+
179194
if (empty($requestedProps)) {
180195
return;
181196
}

0 commit comments

Comments
 (0)