summaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration/Collaborators/MailPlugin.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-10-29 17:00:09 +0100
committerJulius Härtl <jus@bitgrid.net>2018-10-30 10:19:35 +0100
commit61af60752555bb0c7f0a30cb7b7f35e7ca45fa45 (patch)
treef9597f423477fef10fa687d7ba98ed8dcc3866b9 /lib/private/Collaboration/Collaborators/MailPlugin.php
parent192324e4decc850d5def1394581a0dce2f2402d6 (diff)
downloadnextcloud-server-61af60752555bb0c7f0a30cb7b7f35e7ca45fa45.tar.gz
nextcloud-server-61af60752555bb0c7f0a30cb7b7f35e7ca45fa45.zip
Make enhancing entries with type property optional
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Collaboration/Collaborators/MailPlugin.php')
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index e89e22d012e..1d0738677bb 100644
--- a/lib/private/Collaboration/Collaborators/MailPlugin.php
+++ b/lib/private/Collaboration/Collaborators/MailPlugin.php
@@ -84,11 +84,16 @@ class MailPlugin implements ISearchPlugin {
foreach ($addressBookContacts as $contact) {
if (isset($contact['EMAIL'])) {
$emailAddresses = $contact['EMAIL'];
- if (!is_array($emailAddresses)) {
+ if (\is_string($emailAddresses)) {
$emailAddresses = [$emailAddresses];
}
foreach ($emailAddresses as $type => $emailAddress) {
$displayName = $emailAddress;
+ if (\is_array($emailAddress)) {
+ $emailAddressData = $emailAddress;
+ $emailAddress = $emailAddressData['value'];
+ $emailAddressType = $emailAddressData['type'];
+ }
if (isset($contact['FN'])) {
$displayName = $contact['FN'] . ' (' . $emailAddress . ')';
}
@@ -163,7 +168,7 @@ class MailPlugin implements ISearchPlugin {
$result['exact'][] = [
'label' => $displayName,
'uuid' => $contact['UID'],
- 'type' => $type,
+ 'type' => $emailAddressType,
'value' => [
'shareType' => Share::SHARE_TYPE_EMAIL,
'shareWith' => $emailAddress,
@@ -173,7 +178,7 @@ class MailPlugin implements ISearchPlugin {
$result['wide'][] = [
'label' => $displayName,
'uuid' => $contact['UID'],
- 'type' => $type,
+ 'type' => $emailAddressType,
'value' => [
'shareType' => Share::SHARE_TYPE_EMAIL,
'shareWith' => $emailAddress,