diff options
author | Joas Schilling <coding@schilljs.com> | 2018-03-01 12:18:44 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-03-09 10:15:04 +0100 |
commit | 5b6590f1e912bdf5dcbab8b37753b67c17c10868 (patch) | |
tree | 1141aebd55ee40230e08bd31b16c4f34514a22d9 | |
parent | d1547ee3b07b6a553dbbb4bcdd03f0d348b23156 (diff) | |
download | nextcloud-server-5b6590f1e912bdf5dcbab8b37753b67c17c10868.tar.gz nextcloud-server-5b6590f1e912bdf5dcbab8b37753b67c17c10868.zip |
Also array_slice wide email matches of local users
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/private/Collaboration/Collaborators/MailPlugin.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 464b6702066..7324d73a9ab 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -73,7 +73,7 @@ class MailPlugin implements ISearchPlugin { * @since 13.0.0 */ public function search($search, $limit, $offset, ISearchResult $searchResult) { - $result = ['wide' => [], 'exact' => []]; + $result = $userResults = ['wide' => [], 'exact' => []]; $userType = new SearchResultType('users'); $emailType = new SearchResultType('emails'); @@ -136,14 +136,13 @@ class MailPlugin implements ISearchPlugin { } if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) { - $singleResult = [[ + $userResults['wide'][] = [ 'label' => $contact['FN'] . " ($emailAddress)", 'value' => [ 'shareType' => Share::SHARE_TYPE_USER, 'shareWith' => $cloud->getUser(), - ]], + ], ]; - $searchResult->addResultSet($userType, $singleResult, []); } } continue; @@ -175,10 +174,13 @@ class MailPlugin implements ISearchPlugin { if (!$this->shareeEnumeration) { $result['wide'] = []; + $userResults['wide'] = []; } else { $result['wide'] = array_slice($result['wide'], $offset, $limit); + $userResults['wide'] = array_slice($userResults['wide'], $offset, $limit); } + if (!$searchResult->hasExactIdMatch($emailType) && filter_var($search, FILTER_VALIDATE_EMAIL)) { $result['exact'][] = [ 'label' => $search, @@ -190,6 +192,7 @@ class MailPlugin implements ISearchPlugin { } $searchResult->addResultSet($emailType, $result['wide'], $result['exact']); + $searchResult->addResultSet($userType, [], $userResults['wide']); return true; } |