aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis <6653109+artonge@users.noreply.github.com>2023-02-16 14:01:19 +0100
committerGitHub <noreply@github.com>2023-02-16 14:01:19 +0100
commit98b998a2de2a0a013028fadec2e3618852442ce9 (patch)
treef1a3bb7fc9f9fa2f18bdc448d99e9439516b193f
parentbc91dca7035c06e32131d23565f30535b8850bb0 (diff)
parentb38d2daede9f6079040412d0a0531ac549433582 (diff)
downloadnextcloud-server-98b998a2de2a0a013028fadec2e3618852442ce9.tar.gz
nextcloud-server-98b998a2de2a0a013028fadec2e3618852442ce9.zip
Merge pull request #36735 from nextcloud/fix/32635/fix-vcf-contacts
fix the contacts-menu vcf-contact avatars
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php8
-rw-r--r--tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php2
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index a0a14cd9cbd..3a75e924d24 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -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);
}
diff --git a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
index a038058069e..ccb888a6c3d 100644
--- a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
@@ -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')