Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions lib/private/Contacts/ContactsMenu/ContactsStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public function getContacts(IUser $user, $filter, ?int $limit = null, ?int $offs
}
return true;
});

$entries = array_map(function (array $contact) {
return $this->contactArrayToEntry($contact);
}, $contacts);
Expand Down Expand Up @@ -312,19 +311,17 @@ public function findOne(IUser $user, $shareType, $shareWith) {
private function contactArrayToEntry(array $contact) {
$entry = new Entry();

if (isset($contact['id'])) {
$entry->setId($contact['id']);
if (isset($contact['UID'])) {
$entry->setId($contact['UID']);
$uid = $contact['UID'];
$avatar = "/index.php/avatar/$uid/64";
$entry->setAvatar($avatar);
}

if (isset($contact['FN'])) {
$entry->setFullName($contact['FN']);
}

$avatarPrefix = "VALUE=uri:";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the two way should be keep. e.g. first try looking if the PHOTO property exists and if not fallback to the UID?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mstolf I left line 323 throw 327 in place and only added 314 throw 318 and its working for me

if (isset($contact['PHOTO']) && strpos($contact['PHOTO'], $avatarPrefix) === 0) {
$entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix)));
}

if (isset($contact['EMAIL'])) {
foreach ($contact['EMAIL'] as $email) {
$entry->addEMailAddress($email);
Expand Down