From 82663835ad8f358d38042c524376e5db3640826e Mon Sep 17 00:00:00 2001 From: David Dreschner Date: Wed, 24 Jun 2026 16:50:44 +0200 Subject: [PATCH] fix(SocialApi): Use correct constructor signature for ContactsManager Signed-off-by: David Dreschner --- lib/Service/SocialApiService.php | 11 ++++++++--- tests/unit/Service/SocialApiServiceTest.php | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/Service/SocialApiService.php b/lib/Service/SocialApiService.php index 5665174e32..de73c2449e 100644 --- a/lib/Service/SocialApiService.php +++ b/lib/Service/SocialApiService.php @@ -38,6 +38,7 @@ use OCP\Contacts\IManager; use OCP\Http\Client\IClientService; use OCP\IAddressBook; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; @@ -50,6 +51,8 @@ class SocialApiService { private $manager; /** @var IConfig */ private $config; + /** @var IAppConfig */ + private $appConfig; /** @var IClientService */ private $clientService; /** @var IL10N */ @@ -69,6 +72,7 @@ public function __construct( CompositeSocialProvider $socialProvider, IManager $manager, IConfig $config, + IAppConfig $appConfig, IClientService $clientService, IL10N $l10n, IURLGenerator $urlGen, @@ -80,6 +84,7 @@ public function __construct( $this->socialProvider = $socialProvider; $this->manager = $manager; $this->config = $config; + $this->appConfig = $appConfig; $this->clientService = $clientService; $this->l10n = $l10n; $this->urlGen = $urlGen; @@ -162,7 +167,7 @@ protected function getAddressBook(string $addressbookId, IManager $manager = nul * @param {IManager} the contact manager to load */ protected function registerAddressbooks($userId, IManager $manager) { - $coma = new ContactsManager($this->davBackend, $this->l10n, $this->propertyMapper); + $coma = new ContactsManager($this->davBackend, $this->l10n, $this->propertyMapper, $this->appConfig); $coma->setupContactsProvider($manager, $userId, $this->urlGen); $this->manager = $manager; } @@ -274,7 +279,7 @@ public function updateContact(string $addressbookId, string $contactId, ?string */ public function existsAddressBook(string $searchBookId, string $userId): bool { $manager = $this->manager; - $coma = new ContactsManager($this->davBackend, $this->l10n, $this->propertyMapper); + $coma = new ContactsManager($this->davBackend, $this->l10n, $this->propertyMapper, $this->appConfig); $coma->setupContactsProvider($manager, $userId, $this->urlGen); $addressBooks = $manager->getUserAddressBooks(); return $this->getAddressBook($searchBookId, $manager) !== null; @@ -292,7 +297,7 @@ public function existsAddressBook(string $searchBookId, string $userId): bool { public function existsContact(string $searchContactId, string $searchBookId, string $userId): bool { // load address books for the user $manager = $this->manager; - $coma = new ContactsManager($this->davBackend, $this->l10n, $this->propertyMapper); + $coma = new ContactsManager($this->davBackend, $this->l10n, $this->propertyMapper, $this->appConfig); $coma->setupContactsProvider($manager, $userId, $this->urlGen); $addressBook = $this->getAddressBook($searchBookId, $manager); if ($addressBook == null) { diff --git a/tests/unit/Service/SocialApiServiceTest.php b/tests/unit/Service/SocialApiServiceTest.php index 04ecec03bf..46592c953d 100644 --- a/tests/unit/Service/SocialApiServiceTest.php +++ b/tests/unit/Service/SocialApiServiceTest.php @@ -31,6 +31,7 @@ use OCP\Http\Client\IClient; use OCP\Http\Client\IResponse; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\IConfig; use OCP\Contacts\IManager; use OCP\IAddressBook; @@ -53,6 +54,8 @@ class SocialApiServiceTest extends TestCase { private $manager; /** @var IConfig&MockObject */ private $config; + /** @var IAppConfig&MockObject */ + private $appConfig; /** @var IClientService&MockObject */ private $clientService; /** @var IL10N&MockObject */ @@ -126,6 +129,7 @@ protected function setUp(): void { $this->manager = $this->createMock(IManager::class); $this->config = $this->createMock(IConfig::class); + $this->appConfig = $this->createMock(IAppConfig::class); $this->socialProvider = $this->createMock(CompositeSocialProvider::class); $this->clientService = $this->createMock(IClientService::class); $this->l10n = $this->createMock(IL10N::class); @@ -138,6 +142,7 @@ protected function setUp(): void { $this->socialProvider, $this->manager, $this->config, + $this->appConfig, $this->clientService, $this->l10n, $this->urlGen,