Skip to content

Commit

Permalink
Improve email search results
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and szaimen committed Dec 3, 2022
1 parent a39e6fb commit 85ae0c7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/private/Collaboration/Collaborators/MailPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
return false;
}

// Extract the email address from "Foo Bar <foo.bar@example.tld>" and then search with "foo.bar@example.tld" instead
$result = preg_match('/<([^@]+@.+)>$/', $search, $matches);
if ($result && filter_var($matches[1], FILTER_VALIDATE_EMAIL)) {
return $this->search($matches[1], $limit, $offset, $searchResult);
}

$currentUserId = $this->userSession->getUser()->getUID();

$result = $userResults = ['wide' => [], 'exact' => []];
Expand Down

0 comments on commit 85ae0c7

Please sign in to comment.