Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] fix(cardav): only show users from enabled addressBooks in contacts menu #51538

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

backportbot[bot]
Copy link

@backportbot backportbot bot commented Mar 17, 2025

Backport of #51380

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot backportbot bot added bug 3. to review Waiting for reviews pending documentation This pull request needs an associated documentation update feature: carddav Related to CardDAV internals labels Mar 17, 2025
@backportbot backportbot bot added this to the Nextcloud 30.0.8 milestone Mar 17, 2025
@hamza221 hamza221 force-pushed the backport/51380/stable30 branch 2 times, most recently from 58303c5 to 031cf2f Compare March 21, 2025 14:10
@hamza221 hamza221 marked this pull request as ready for review March 21, 2025 14:10
@@ -262,12 +262,11 @@
$cm->setupContactsProvider($contactsManager, $userID, $urlGenerator);
}

private function setupSystemContactsProvider(IContactsManager $contactsManager,
IAppContainer $container): void {
private function setupSystemContactsProvider(IContactsManager $contactsManager, IAppContainer $container): void {

Check notice

Code scanning / Psalm

DeprecatedInterface Note

Interface OCP\AppFramework\IAppContainer is marked as deprecated
}

$path = 'addressbooks/users/' . $user . '/' . $uri;
$properties = $this->propertyMapper->findPropertyByPathAndName($user, $path, '{http://owncloud.org/ns}enabled');

Check notice

Code scanning / Psalm

PossiblyInvalidArgument Note

Argument 1 of OCA\DAV\Db\PropertyMapper::findPropertyByPathAndName expects string, but possibly different type array<array-key, string>|string provided
* @param IURLGenerator $urlGenerator
*/
public function setupSystemContactsProvider(IManager $cm, IURLGenerator $urlGenerator) {
public function setupSystemContactsProvider(IManager $cm, ?string $userId, IURLGenerator $urlGenerator) {

Check notice

Code scanning / Psalm

MissingReturnType Note

Method OCA\DAV\CardDAV\ContactsManager::setupSystemContactsProvider does not have a return type, expecting void
*/
private function register(IManager $cm, $addressBooks, $urlGenerator) {
private function register(IManager $cm, $addressBooks, $urlGenerator, ?string $userId) {

Check notice

Code scanning / Psalm

MissingReturnType Note

Method OCA\DAV\CardDAV\ContactsManager::register does not have a return type, expecting void
*/
private function register(IManager $cm, $addressBooks, $urlGenerator) {
private function register(IManager $cm, $addressBooks, $urlGenerator, ?string $userId) {

Check notice

Code scanning / Psalm

MissingParamType Note

Parameter $addressBooks has no provided type
Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
@hamza221 hamza221 force-pushed the backport/51380/stable30 branch from 031cf2f to e55a375 Compare March 21, 2025 14:14
@@ -323,4 +336,25 @@
$this->addressBookInfo['{DAV:}displayname'] === $this->urlGenerator->getBaseUrl()
);
}

public function isEnabled(): bool {
if (!$this->userId) {

Check notice

Code scanning / Psalm

RiskyTruthyFalsyComparison Note

Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead.
$uri = $this->addressBookInfo['uri'];
}

$path = 'addressbooks/users/' . $user . '/' . $uri;

Check notice

Code scanning / Psalm

PossiblyInvalidOperand Note

Cannot concatenate with a array<array-key, string>|string
@hamza221
Copy link
Contributor

Cypress looks unrelated

@ChristophWurst ChristophWurst merged commit cf130f4 into stable30 Mar 26, 2025
263 of 286 checks passed
@ChristophWurst ChristophWurst deleted the backport/51380/stable30 branch March 26, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug feature: carddav Related to CardDAV internals pending documentation This pull request needs an associated documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants