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
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue