Skip to content

Conversation

@JohannesGGE
Copy link
Contributor

@JohannesGGE JohannesGGE commented May 22, 2023

Summary

TODO

  • ...

Checklist

@JohannesGGE JohannesGGE self-assigned this May 22, 2023
@JohannesGGE
Copy link
Contributor Author

Due to the different implementation of the recently contacted addressbook, the call for changing the enabled property can't be executed, and an "addressbook is immutable" is thrown in apps/contactsinteraction/lib/AddressBook.php::propPatch().

Other addressbooks call apps/dav/lib/CardDAV/AddressBook.php::propPatch()

As far as I can tell the only needed code is the DB update of apps/dav/lib/DAV/CustomPropertiesBackend.php::updateProperties() to have a working enable/disable for the recently contacted addressbook.

@JohannesGGE
Copy link
Contributor Author

Recently contacted address book will be tackled in another issue.

}

public function propPatch(PropPatch $propPatch) {
if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this dropped?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

owner-principal seems to be set if the address book is shared, system or recently contacted. Own address books don't have this prop.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change also surprised me.

Apparently, this was added before the CustomPropertiesBackend: 95e218b

If we throw forbidden here, the CustomPropertiesBackend::propPatch is not executed?

]
],
[
'privilege' => '{DAV:}write-properties',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this means users are now allowed to update properties of all address books, right? are there any property changes we might not want? e.g. rename.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just tested it with renaming, and it turns out the change of the name is not stored as a user prop but changes the real name, so the owner sees the change as well. I'll have a look in the code again to check where the distinction between the props is made.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tcitworld As far as I understand it, the propPatch() in CustomPropertiesBackend.php is just called if the prop is a user prop. So the distinction is done somewhere before

@ChristophWurst ChristophWurst added feature: dav feature: caldav Related to CalDAV internals labels May 24, 2023
@JohannesGGE JohannesGGE added 2. developing Work in progress and removed 3. to review Waiting for reviews labels May 24, 2023
@JohannesGGE JohannesGGE marked this pull request as draft May 25, 2023 10:24
@JohannesGGE
Copy link
Contributor Author

The addressbook is now checked for sharing. If it is shared the props will be saved as userProps. So even if the addressbook is renamed by user that is not the owner (not possible in the contacts app yet), the owners addressbook name isn't changed. For the case the addressbook has a userProp name, this name is shown now.

Comment on lines 179 to 193
// substr of addressbooks/ => path is inside the CardDAV component
// three '/' => this a addressbook (no addressbook-home nor contact object)
if (substr($path, 0, 13) === 'addressbooks/' && substr_count($path, '/') === 3) {
$allRequestedProps = $propFind->getRequestedProperties();
$customPropertiesForShares = [
'{DAV:}displayname',
];

foreach ($customPropertiesForShares as $customPropertyForShares) {
if (in_array($customPropertyForShares, $allRequestedProps)) {
$requestedProps[] = $customPropertyForShares;
}
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I think there's a way to factorize this block with the block above in a single function which takes calendars and addressbooks specifics as parameters.

@JohannesGGE JohannesGGE added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 13, 2023
@JohannesGGE JohannesGGE marked this pull request as ready for review June 13, 2023 08:49
@JohannesGGE JohannesGGE force-pushed the enh/contacts/hide-adressbook-option branch from 556aa6b to 60c9eb5 Compare June 23, 2023 15:03
@JohannesGGE JohannesGGE force-pushed the enh/contacts/hide-adressbook-option branch from 60c9eb5 to 7594644 Compare July 7, 2023 07:44
@JohannesGGE JohannesGGE force-pushed the enh/contacts/hide-adressbook-option branch from 7594644 to dbb174a Compare July 10, 2023 11:38
@JohannesGGE JohannesGGE force-pushed the enh/contacts/hide-adressbook-option branch from dbb174a to bb80295 Compare July 10, 2023 11:39
@kesselb
Copy link
Contributor

kesselb commented Jul 18, 2023

nitpick: enh(contacts) should be feat(contacts) according to https://www.conventionalcommits.org/en/v1.0.0/

@kesselb kesselb added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jul 18, 2023
Copy link
Contributor

@kesselb kesselb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done 🎉

@miaulalala
Copy link
Contributor

/backport to stable27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement feature: caldav Related to CalDAV internals feature: dav

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new option to hide an address book's contacts without disabling the address book

6 participants