diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-10-29 17:00:09 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-10-30 10:19:35 +0100 |
commit | 61af60752555bb0c7f0a30cb7b7f35e7ca45fa45 (patch) | |
tree | f9597f423477fef10fa687d7ba98ed8dcc3866b9 /lib/private/Collaboration/Collaborators/MailPlugin.php | |
parent | 192324e4decc850d5def1394581a0dce2f2402d6 (diff) | |
download | nextcloud-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.php | 11 |
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, |