summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-03-06 22:21:03 +0100
committerGitHub <noreply@github.com>2018-03-06 22:21:03 +0100
commit65cc155a1168ef0307d4d6bbe593611c34d1b89b (patch)
treec6cd6e25bf5ec666d0d00645c68f6924e42c97b5
parentde56915605ed1b714b7d9e6320e22c71da5379fd (diff)
parente05f338ff19f910197212768e179587d31bd0299 (diff)
downloadnextcloud-server-65cc155a1168ef0307d4d6bbe593611c34d1b89b.tar.gz
nextcloud-server-65cc155a1168ef0307d4d6bbe593611c34d1b89b.zip
Merge pull request #8596 from nextcloud/bugfix/8454/sharee-email-matches-not-limited
Also array_slice wide email matches of local users
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index b4964825182..c3816161ce3 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,
@@ -189,6 +191,9 @@ class MailPlugin implements ISearchPlugin {
];
}
+ if (!empty($userResults['wide'])) {
+ $searchResult->addResultSet($userType, $userResults['wide'], []);
+ }
$searchResult->addResultSet($emailType, $result['wide'], $result['exact']);
return true;