diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-03-14 14:30:45 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-03-20 14:35:46 +0100 |
commit | e2e27004ffed5a10c8c3d3eee516a2b20d2b9d46 (patch) | |
tree | 4413a5ff694873f2d3e7f073aa0117ebfc52f620 /lib | |
parent | a6f1721c2d1fa13a6f2cd48556392327fee64151 (diff) | |
download | nextcloud-server-e2e27004ffed5a10c8c3d3eee516a2b20d2b9d46.tar.gz nextcloud-server-e2e27004ffed5a10c8c3d3eee516a2b20d2b9d46.zip |
the FN is optional, carrying the displayname if present
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Collaboration/Collaborators/MailPlugin.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 075689a068e..1693930a3e5 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -88,6 +88,10 @@ class MailPlugin implements ISearchPlugin { $emailAddresses = [$emailAddresses]; } foreach ($emailAddresses as $emailAddress) { + $displayName = $emailAddress; + if (isset($contact['FN'])) { + $displayName = $contact['FN'] . ' (' . $emailAddress . ')'; + } $exactEmailMatch = strtolower($emailAddress) === $lowerSearch; if (isset($contact['isLocalSystemBook'])) { @@ -116,7 +120,7 @@ class MailPlugin implements ISearchPlugin { if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) { $singleResult = [[ - 'label' => $contact['FN'] . " ($emailAddress)", + 'label' => $displayName, 'value' => [ 'shareType' => Share::SHARE_TYPE_USER, 'shareWith' => $cloud->getUser(), @@ -137,7 +141,7 @@ class MailPlugin implements ISearchPlugin { if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) { $userResults['wide'][] = [ - 'label' => $contact['FN'] . " ($emailAddress)", + 'label' => $displayName, 'value' => [ 'shareType' => Share::SHARE_TYPE_USER, 'shareWith' => $cloud->getUser(), @@ -148,12 +152,14 @@ class MailPlugin implements ISearchPlugin { continue; } - if ($exactEmailMatch || strtolower($contact['FN']) === $lowerSearch) { + if ($exactEmailMatch + || isset($contact['FN']) && strtolower($contact['FN']) === $lowerSearch) + { if ($exactEmailMatch) { $searchResult->markExactIdMatch($emailType); } $result['exact'][] = [ - 'label' => $contact['FN'] . " ($emailAddress)", + 'label' => $displayName, 'value' => [ 'shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => $emailAddress, @@ -161,7 +167,7 @@ class MailPlugin implements ISearchPlugin { ]; } else { $result['wide'][] = [ - 'label' => $contact['FN'] . " ($emailAddress)", + 'label' => $displayName, 'value' => [ 'shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => $emailAddress, |