Browse Source

fix the contacts-menu vcf-contact avatars

Signed-off-by: Simon L <szaimen@e.mail.de>
Simon L 1 year ago
parent
commit
b38d2daede

+ 7 - 1
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);
 		}
 

+ 1 - 1
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')