Merge pull request #879 from e-foundation/fix-contacts-suggestions-nextcloud

Add check to unregister system addressbook
This commit is contained in:
the-djmaze 2023-01-26 21:53:44 +01:00 committed by GitHub
commit dc6674af4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,12 @@ class NextcloudContactsSuggestions implements \RainLoop\Providers\Suggestions\IS
return [];
}
// Unregister system addressbook so as to return only contacts in user's addressbooks
foreach($cm->getUserAddressBooks() as $addressBook) {
if($addressBook->isSystemAddressBook()) {
$cm->unregisterAddressBook($addressBook);
}
}
$aSearchResult = $cm->search($sQuery, array('FN', 'NICKNAME', 'TITLE', 'EMAIL'));
//$this->oLogger->WriteDump($aSearchResult);