diff options
author | call-me-matt <nextcloud@matthiasheinisch.de> | 2022-05-04 13:02:00 +0200 |
---|---|---|
committer | call-me-matt <nextcloud@matthiasheinisch.de> | 2022-05-04 13:15:08 +0200 |
commit | 991cc65f0f3e1cb446362b5b48224409779b35dc (patch) | |
tree | 88e7b395ecaf22a7b6f401b71ba0e2c17bcd4d7c | |
parent | a84d7fa7ce66839a0e44934faf652e8c3a69fc23 (diff) |
optimize search for contacts with social data
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
-rw-r--r-- | lib/Service/SocialApiService.php | 14 | ||||
-rw-r--r-- | tests/unit/Service/SocialApiServiceTest.php | 1 |
2 files changed, 1 insertions, 14 deletions
diff --git a/lib/Service/SocialApiService.php b/lib/Service/SocialApiService.php index b7a4d3a8..e1c85cf4 100644 --- a/lib/Service/SocialApiService.php +++ b/lib/Service/SocialApiService.php @@ -38,7 +38,6 @@ use OCP\IAddressBook; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; -use OCP\Util; class SocialApiService { private $appName; @@ -368,8 +367,6 @@ class SocialApiService { foreach ($addressBooks as $addressBook) { if ((is_null($addressBook) || - (Util::getVersion()[0] >= 20) && - //TODO: remove version check ^ when dependency for contacts is min NCv20 (see info.xml) ($addressBook->isShared() || $addressBook->isSystemAddressBook()))) { // TODO: filter out deactivated books, see https://github.com/nextcloud/server/issues/17537 continue; @@ -384,16 +381,7 @@ class SocialApiService { } // get contacts in that addressbook - //TODO: activate this optimization when nextcloud/server#22085 is merged - /* - if (Util::getVersion()[0] < 21) { - //TODO: remove this branch when dependency for contacts is min NCv21 (see info.xml) - $contacts = $addressBook->search('', ['UID'], ['types' => true]); - } else { - $contacts = $addressBook->search('', ['X-SOCIALPROFILE'], ['types' => true]); - } - */ - $contacts = $addressBook->search('', ['UID'], ['types' => true]); + $contacts = $addressBook->search('', ['X-SOCIALPROFILE'], ['types' => true]); usort($contacts, [$this, 'sortContacts']); // make sure the order stays the same in consecutive calls // update one contact after another diff --git a/tests/unit/Service/SocialApiServiceTest.php b/tests/unit/Service/SocialApiServiceTest.php index 675f81f6..579247b0 100644 --- a/tests/unit/Service/SocialApiServiceTest.php +++ b/tests/unit/Service/SocialApiServiceTest.php @@ -466,7 +466,6 @@ class SocialApiServiceTest extends TestCase { $this->assertArrayHasKey('failed', $report[0]); $this->assertArrayHasKey('412', $report[0]['failed']); $this->assertContains('Invalid Contact', $report[0]['failed']['412']); - $this->assertContains('Empty Contact', $report[0]['failed']['412']); } } |