From dd191354cdb2674b47a0d5d9bf1a97ee1e4f5e81 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 23 Jun 2026 13:30:57 +0200 Subject: [PATCH] fix(Collaborators): Fix matching emails to remote users if no remote results are present Signed-off-by: provokateurin --- .../Collaboration/Collaborators/Search.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index c57e8f43fa050..b02640c5054e2 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -92,8 +92,6 @@ protected function dropMailSharesWhereRemoteShareIsPossible(ISearchResult $searc $allResults = $searchResult->asArray(); $emailType = new SearchResultType('emails'); - $remoteType = new SearchResultType('remotes'); - $emailLabel = $emailType->getLabel(); $emailEntries = array_merge( $allResults['exact'][$emailLabel] ?? [], @@ -112,14 +110,18 @@ protected function dropMailSharesWhereRemoteShareIsPossible(ISearchResult $searc $mailIdMap[$mailRow['uuid']] = $mailRow['value']['shareWith']; } - foreach ($allResults[$remoteType->getLabel()] as $resultRow) { - if (!isset($resultRow['uuid'])) { - continue; - } - if (isset($mailIdMap[$resultRow['uuid']])) { - $searchResult->removeCollaboratorResult($emailType, $mailIdMap[$resultRow['uuid']]); + $remoteType = new SearchResultType('remotes'); + if (isset($allResults[$remoteType->getLabel()])) { + foreach ($allResults[$remoteType->getLabel()] as $resultRow) { + if (!isset($resultRow['uuid'])) { + continue; + } + if (isset($mailIdMap[$resultRow['uuid']])) { + $searchResult->removeCollaboratorResult($emailType, $mailIdMap[$resultRow['uuid']]); + } } } + $lookupType = new SearchResultType('lookup'); if (isset($allResults[$lookupType->getLabel()])) { foreach ($allResults[$lookupType->getLabel()] as $resultRow) {