Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/Service/SocialApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -50,6 +51,8 @@ class SocialApiService {
private $manager;
/** @var IConfig */
private $config;
/** @var IAppConfig */
private $appConfig;
/** @var IClientService */
private $clientService;
/** @var IL10N */
Expand All @@ -69,6 +72,7 @@ public function __construct(
CompositeSocialProvider $socialProvider,
IManager $manager,
IConfig $config,
IAppConfig $appConfig,
IClientService $clientService,
IL10N $l10n,
IURLGenerator $urlGen,
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Service/SocialApiServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 */
Expand Down Expand Up @@ -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);
Expand All @@ -138,6 +142,7 @@ protected function setUp(): void {
$this->socialProvider,
$this->manager,
$this->config,
$this->appConfig,
$this->clientService,
$this->l10n,
$this->urlGen,
Expand Down
Loading