Skip to content

Commit

Permalink
Add fallback options for contacts array
Browse files Browse the repository at this point in the history
when the UID or FN is null, the email address / dsiplay name will be used instead

Signed-off-by: Anna Larch <anna@nextcloud.com>
  • Loading branch information
miaulalala committed Oct 2, 2022
1 parent 1150587 commit b1617bc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/private/Collaboration/Collaborators/MailPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
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(),
Expand Down Expand Up @@ -205,8 +205,8 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
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(),
Expand All @@ -226,8 +226,8 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
}
$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,
Expand All @@ -237,8 +237,8 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
} 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,
Expand Down

0 comments on commit b1617bc

Please sign in to comment.