summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2018-03-19 17:57:12 +0100
committerGitHub <noreply@github.com>2018-03-19 17:57:12 +0100
commit7ae42f1f5d1159d7b19b3d9d824a9470c99be7b8 (patch)
treea2f2fb582c3c455f89340b698c801bd74ffa1edd /lib
parent734cddfa9792cd2f47b25b1bcf5c447aec5df367 (diff)
parentf42c29ebaceafc75f387d60b1f5e3a0cce15b1db (diff)
downloadnextcloud-server-7ae42f1f5d1159d7b19b3d9d824a9470c99be7b8.tar.gz
nextcloud-server-7ae42f1f5d1159d7b19b3d9d824a9470c99be7b8.zip
Merge pull request #8822 from nextcloud/fix/8641/undefined-index
the FN is optional, carrying the displayname if present
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index ee5fcd60bdb..101d6845ec3 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,