diff options
author | Anna Larch <anna@nextcloud.com> | 2022-09-23 14:38:43 +0200 |
---|---|---|
committer | Anna (Rebase PR Action) <miaulalala@users.noreply.github.com> | 2022-10-01 22:47:58 +0000 |
commit | 88b0aea2b0f7cc30ab0de7d13914474d0711e5cd (patch) | |
tree | 435df81994415292be5a445c3fc4a83df8c1d86f /lib/private/Collaboration | |
parent | 9d027046827f7ebea18aeeda0f03fe98ee2dc1e7 (diff) | |
download | nextcloud-server-88b0aea2b0f7cc30ab0de7d13914474d0711e5cd.tar.gz nextcloud-server-88b0aea2b0f7cc30ab0de7d13914474d0711e5cd.zip |
Add fallback options for contacts array
when the UID or FN is null, the email address / dsiplay name will be used instead
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib/private/Collaboration')
-rw-r--r-- | lib/private/Collaboration/Collaborators/MailPlugin.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 8c2efce6f0d..d34d9fb0087 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -165,8 +165,8 @@ class MailPlugin implements ISearchPlugin { if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) { $singleResult = [[ 'label' => $displayName, - 'uuid' => $contact['UID'], - 'name' => $contact['FN'], + 'uuid' => $contact['UID'] ?? $emailAddress, + 'name' => $contact['FN'] ?? $displayName, 'value' => [ 'shareType' => IShare::TYPE_USER, 'shareWith' => $cloud->getUser(), @@ -205,8 +205,8 @@ class MailPlugin implements ISearchPlugin { if ($addToWide && !$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) { $userResults['wide'][] = [ 'label' => $displayName, - 'uuid' => $contact['UID'], - 'name' => $contact['FN'], + 'uuid' => $contact['UID'] ?? $emailAddress, + 'name' => $contact['FN'] ?? $displayName, 'value' => [ 'shareType' => IShare::TYPE_USER, 'shareWith' => $cloud->getUser(), @@ -226,8 +226,8 @@ class MailPlugin implements ISearchPlugin { } $result['exact'][] = [ 'label' => $displayName, - 'uuid' => $contact['UID'], - 'name' => $contact['FN'], + 'uuid' => $contact['UID'] ?? $emailAddress, + 'name' => $contact['FN'] ?? $displayName, 'type' => $emailAddressType ?? '', 'value' => [ 'shareType' => IShare::TYPE_EMAIL, @@ -237,8 +237,8 @@ class MailPlugin implements ISearchPlugin { } else { $result['wide'][] = [ 'label' => $displayName, - 'uuid' => $contact['UID'], - 'name' => $contact['FN'], + 'uuid' => $contact['UID'] ?? $emailAddress, + 'name' => $contact['FN'] ?? $displayName, 'type' => $emailAddressType ?? '', 'value' => [ 'shareType' => IShare::TYPE_EMAIL, |