Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2020-04-23 23:20:58 +0300
committerGitHub <noreply@github.com>2020-04-23 23:20:58 +0300
commit038045d55e039262564254c3ac75aaa7965eb200 (patch)
treebbd802349d83183ea02770180b222e6ce6840708 /lib
parent24e58947d6fba02c3d0ff709213f527411fcec0c (diff)
parent6709833dc7248fe448b6b809584d9a2e9546af7b (diff)
Merge pull request #18816 from nextcloud/bugfix/noid/paginate-contacts-search
Use paginated search for contacts
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php3
-rw-r--r--lib/private/Collaboration/Collaborators/RemotePlugin.php3
-rw-r--r--lib/private/ContactsManager.php2
-rw-r--r--lib/public/Contacts/IManager.php2
-rw-r--r--lib/public/IAddressBook.php2
5 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index e387e38c6dc..8266ca6794f 100644
--- a/lib/private/Collaboration/Collaborators/MailPlugin.php
+++ b/lib/private/Collaboration/Collaborators/MailPlugin.php
@@ -81,8 +81,7 @@ class MailPlugin implements ISearchPlugin {
$emailType = new SearchResultType('emails');
// Search in contacts
- //@todo Pagination missing
- $addressBookContacts = $this->contactsManager->search($search, ['EMAIL', 'FN']);
+ $addressBookContacts = $this->contactsManager->search($search, ['EMAIL', 'FN'], ['limit' => $limit, 'offset' => $offset]);
$lowerSearch = strtolower($search);
foreach ($addressBookContacts as $contact) {
if (isset($contact['EMAIL'])) {
diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php
index 6309b8e6eab..e4340f4c19b 100644
--- a/lib/private/Collaboration/Collaborators/RemotePlugin.php
+++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php
@@ -67,8 +67,7 @@ class RemotePlugin implements ISearchPlugin {
$resultType = new SearchResultType('remotes');
// Search in contacts
- //@todo Pagination missing
- $addressBookContacts = $this->contactsManager->search($search, ['CLOUD', 'FN']);
+ $addressBookContacts = $this->contactsManager->search($search, ['CLOUD', 'FN'], ['limit' => $limit, 'offset' => $offset]);
foreach ($addressBookContacts as $contact) {
if (isset($contact['isLocalSystemBook'])) {
continue;
diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php
index c28e7f6ad4b..fca0a6e5ba3 100644
--- a/lib/private/ContactsManager.php
+++ b/lib/private/ContactsManager.php
@@ -40,6 +40,8 @@ namespace OC {
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options = array() to define the search behavior
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped
+ * - 'limit' - Set a numeric limit for the search results
+ * - 'offset' - Set the offset for the limited search results
* @return array an array of contacts which are arrays of key-value-pairs
*/
public function search($pattern, $searchProperties = [], $options = []) {
diff --git a/lib/public/Contacts/IManager.php b/lib/public/Contacts/IManager.php
index dcb4c7ddbb3..e0551bcd9dd 100644
--- a/lib/public/Contacts/IManager.php
+++ b/lib/public/Contacts/IManager.php
@@ -96,6 +96,8 @@ interface IManager {
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options = array() to define the search behavior
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped
+ * - 'limit' - Set a numeric limit for the search results
+ * - 'offset' - Set the offset for the limited search results
* @return array an array of contacts which are arrays of key-value-pairs
* @since 6.0.0
*/
diff --git a/lib/public/IAddressBook.php b/lib/public/IAddressBook.php
index 0bce0f44dc0..b2c9a103c2c 100644
--- a/lib/public/IAddressBook.php
+++ b/lib/public/IAddressBook.php
@@ -71,6 +71,8 @@ namespace OCP {
* - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
* example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']]
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped
+ * - 'limit' - Set a numeric limit for the search results
+ * - 'offset' - Set the offset for the limited search results
* @return array an array of contacts which are arrays of key-value-pairs
* example result:
* [