From 26c452c6ee6da909d002a42a15a305e3c5328a3e Mon Sep 17 00:00:00 2001 From: nfebe Date: Wed, 17 Sep 2025 13:20:25 +0100 Subject: [PATCH] fix: Include email when searching share suggestions Signed-off-by: nfebe [skip ci] --- .../Collaboration/Collaborators/RemotePlugin.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php index 1930321c2a0..1a87600ffa7 100644 --- a/lib/private/Collaboration/Collaborators/RemotePlugin.php +++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php @@ -41,7 +41,7 @@ class RemotePlugin implements ISearchPlugin { $resultType = new SearchResultType('remotes'); // Search in contacts - $addressBookContacts = $this->contactsManager->search($search, ['CLOUD', 'FN'], [ + $addressBookContacts = $this->contactsManager->search($search, ['CLOUD', 'FN', 'EMAIL'], [ 'limit' => $limit, 'offset' => $offset, 'enumeration' => false, @@ -83,7 +83,17 @@ class RemotePlugin implements ISearchPlugin { ]; } - if (strtolower($contact['FN']) === $lowerSearch || strtolower($cloudId) === $lowerSearch) { + $emailMatch = false; + if (isset($contact['EMAIL'])) { + $emails = is_array($contact['EMAIL']) ? $contact['EMAIL'] : [$contact['EMAIL']]; + foreach ($emails as $email) { + if (is_string($email) && strtolower($email) === $lowerSearch) { + $emailMatch = true; + break; + } + } + } + if ($emailMatch || strtolower($contact['FN']) === $lowerSearch || strtolower($cloudId) === $lowerSearch) { if (strtolower($cloudId) === $lowerSearch) { $searchResult->markExactIdMatch($resultType); }