Refactor OC\Server::getContactsManager

Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
This commit is contained in:
Andrew Summers 2023-08-29 17:28:27 -05:00
parent 9d1547f59d
commit 29d70d6b75
No known key found for this signature in database
GPG key ID: 1E0B639A223E3E2D
2 changed files with 3 additions and 2 deletions

View file

@ -36,6 +36,7 @@
namespace OC\Share;
use OCA\Files_Sharing\ShareBackend\File;
use OCP\Contacts\IManager as IContactsManager;
use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
@ -596,7 +597,7 @@ class Share extends Constants {
$row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName();
} elseif (isset($row['share_with']) && $row['share_with'] != '' &&
$row['share_type'] === IShare::TYPE_REMOTE) {
$addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD'], [
$addressBookEntries = \OC::$server->get(IContactsManager::class)->search($row['share_with'], ['CLOUD'], [
'limit' => 1,
'enumeration' => false,
'fullmatch' => false,

View file

@ -56,7 +56,7 @@ interface IManager {
* Following function shows how to search for contacts for the name and the email address.
*
* public static function getMatchingRecipient($term) {
* $cm = \OC::$server->getContactsManager();
* $cm = \OC::$server->get(\OCP\Contacts\IManager::class);
* // The API is not active -> nothing to do
* if (!$cm->isEnabled()) {
* return array();