fix(Collaborators): Fix matching emails to remote users if no remote results are present

Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
provokateurin 2026-06-23 13:30:57 +02:00 committed by backportbot[bot]
parent 36fdc11387
commit 58111c207b

View file

@ -92,8 +92,6 @@ class Search implements ISearch {
$allResults = $searchResult->asArray();
$emailType = new SearchResultType('emails');
$remoteType = new SearchResultType('remotes');
$emailLabel = $emailType->getLabel();
$emailEntries = array_merge(
$allResults['exact'][$emailLabel] ?? [],
@ -112,14 +110,18 @@ class Search implements ISearch {
$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) {