Also array_slice wide email matches of local users
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
d1547ee3b0
commit
5b6590f1e9
|
@ -73,7 +73,7 @@ class MailPlugin implements ISearchPlugin {
|
||||||
* @since 13.0.0
|
* @since 13.0.0
|
||||||
*/
|
*/
|
||||||
public function search($search, $limit, $offset, ISearchResult $searchResult) {
|
public function search($search, $limit, $offset, ISearchResult $searchResult) {
|
||||||
$result = ['wide' => [], 'exact' => []];
|
$result = $userResults = ['wide' => [], 'exact' => []];
|
||||||
$userType = new SearchResultType('users');
|
$userType = new SearchResultType('users');
|
||||||
$emailType = new SearchResultType('emails');
|
$emailType = new SearchResultType('emails');
|
||||||
|
|
||||||
|
@ -136,14 +136,13 @@ class MailPlugin implements ISearchPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) {
|
if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) {
|
||||||
$singleResult = [[
|
$userResults['wide'][] = [
|
||||||
'label' => $contact['FN'] . " ($emailAddress)",
|
'label' => $contact['FN'] . " ($emailAddress)",
|
||||||
'value' => [
|
'value' => [
|
||||||
'shareType' => Share::SHARE_TYPE_USER,
|
'shareType' => Share::SHARE_TYPE_USER,
|
||||||
'shareWith' => $cloud->getUser(),
|
'shareWith' => $cloud->getUser(),
|
||||||
]],
|
],
|
||||||
];
|
];
|
||||||
$searchResult->addResultSet($userType, $singleResult, []);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -175,10 +174,13 @@ class MailPlugin implements ISearchPlugin {
|
||||||
|
|
||||||
if (!$this->shareeEnumeration) {
|
if (!$this->shareeEnumeration) {
|
||||||
$result['wide'] = [];
|
$result['wide'] = [];
|
||||||
|
$userResults['wide'] = [];
|
||||||
} else {
|
} else {
|
||||||
$result['wide'] = array_slice($result['wide'], $offset, $limit);
|
$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)) {
|
if (!$searchResult->hasExactIdMatch($emailType) && filter_var($search, FILTER_VALIDATE_EMAIL)) {
|
||||||
$result['exact'][] = [
|
$result['exact'][] = [
|
||||||
'label' => $search,
|
'label' => $search,
|
||||||
|
@ -190,6 +192,7 @@ class MailPlugin implements ISearchPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
$searchResult->addResultSet($emailType, $result['wide'], $result['exact']);
|
$searchResult->addResultSet($emailType, $result['wide'], $result['exact']);
|
||||||
|
$searchResult->addResultSet($userType, [], $userResults['wide']);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue