Merge pull request #34440 from nextcloud/backport/32635/stable24

This commit is contained in:
John Molakvoæ 2022-10-27 14:26:27 +02:00 committed by GitHub
commit 04ec0d7f97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View file

@ -26,7 +26,6 @@ $image-logoheader: url('../../../core/img/logo/logo.svg?v=1');
#app-navigation > ul > li > a:first-child,
#app-navigation > ul > li > ul > li > a:first-child,
#contactsmenu-menu a,
#expanddiv a,
.activity-section .activity-icon.monochrome {
& > img,

View file

@ -312,8 +312,11 @@ class ContactsStore implements IContactsStore {
private function contactArrayToEntry(array $contact) {
$entry = new Entry();
if (isset($contact['id'])) {
$entry->setId($contact['id']);
if (isset($contact['UID'])) {
$uid = $contact['UID'];
$entry->setId($uid);
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $uid, 'size' => 64]);
$entry->setAvatar($avatar);
}
if (isset($contact['FN'])) {

View file

@ -141,6 +141,10 @@ class ContactsStoreTest extends TestCase {
public function testGetContactsWithoutBinaryImage() {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->urlGenerator->expects($this->any())
->method('linkToRouteAbsolute')
->with('core.avatar.getAvatar', $this->anything())
->willReturn('https://urlToNcAvatar.test');
$this->contactsManager->expects($this->once())
->method('search')
->with($this->equalTo(''), $this->equalTo(['FN', 'EMAIL']))
@ -164,7 +168,7 @@ class ContactsStoreTest extends TestCase {
$entries = $this->contactsStore->getContacts($user, '');
$this->assertCount(2, $entries);
$this->assertNull($entries[1]->getAvatar());
$this->assertSame('https://urlToNcAvatar.test', $entries[1]->getAvatar());
}
public function testGetContactsWithoutAvatarURI() {