Merge pull request #36735 from nextcloud/fix/32635/fix-vcf-contacts

fix the contacts-menu vcf-contact avatars
pull/35732/head
Louis 2023-02-16 14:01:19 +07:00 committed by GitHub
commit 98b998a2de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

@ -287,7 +287,13 @@ class ContactsStore implements IContactsStore {
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);
}

@ -142,7 +142,7 @@ class ContactsStoreTest extends TestCase {
$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')