Skip to content
Merged
Show file tree
Hide file tree
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
fix the contacts-menu vcf-contact avatars
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed Feb 15, 2023
commit b38d2daede9f6079040412d0a0531ac549433582
8 changes: 7 additions & 1 deletion lib/private/Contacts/ContactsMenu/ContactsStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,13 @@ private function contactArrayToEntry(array $contact): Entry {
if (isset($contact['UID'])) {
$uid = $contact['UID'];
$entry->setId($uid);
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $uid, 'size' => 64]);
if (isset($contact['isLocalSystemBook'])) {
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $uid, 'size' => 64]);
} elseif (isset($contact['FN'])) {
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => $contact['FN'], 'size' => 64]);
} else {
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => $uid, 'size' => 64]);
}
$entry->setAvatar($avatar);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function testGetContactsWithoutBinaryImage() {
$user = $this->createMock(IUser::class);
$this->urlGenerator->expects($this->any())
->method('linkToRouteAbsolute')
->with('core.avatar.getAvatar', $this->anything())
->with('core.GuestAvatar.getAvatar', $this->anything())
->willReturn('https://urlToNcAvatar.test');
$this->contactsManager->expects($this->once())
->method('search')
Expand Down