Uh oh!
There was an error while loading. Please reload this page.
Fix User profile picture when performing the search - #32635
Conversation
Signed-off-by: Andy Xheli <axheli@axtsolutions.com> Before  After Fix for #31065
| if (isset($contact['UID'])) { | ||
| $entry->setId($contact['UID']); | ||
| $uid = $contact['UID']; | ||
| $avatar = "/index.php/avatar/$uid/64"; |
There was a problem hiding this comment.
This url should probably be built using IURLGenerator and we might need to have special handling for the viability settings, but the change in general makes sense I think.
@nickvergessen Didn't you mention a while back in chat a case on our instance where the contacts menu endpoint was not returning an avatar for a user? Could be related
AndyXheli
commented
Sep 2, 2022
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Andy Xheli <axheli@axtsolutions.com> Co-authored-by: Carl Schwan <carl@carlschwan.eu> Signed-off-by: Andy Xheli <axheli@axtsolutions.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
AndyXheli
left a comment
There was a problem hiding this comment.
Signed-off-by: Andy Xheli axheli@axtsolutions.com
Tested on NC 24 & 25 and it works as it should
Signed-off-by: Andy Xheli <axheli@axtsolutions.com>
AndyXheli
commented
Sep 26, 2022
Hi all, any updates on this on being in NC 25 ? |
blizzz
commented
Sep 29, 2022
@AndyXheli CI is unhappy: There was 1 failure:
/drone/src/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php:166 that test needs adjustements apparently |
Pytal
commented
Sep 29, 2022
This looks to be from the return value of |
blizzz
commented
Oct 1, 2022
Actually the test was ensuring(!) that avatar is null. Now it is not anymore as every time an avatar url is being created. The mock would at least return an empty string, and not null. |
blizzz
commented
Oct 1, 2022
Best probably to do as @Pytal suggested: mock url generator to return a dummy url and expect this. Something like this diff --git a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
index aa609aedbb9..dfdd67fbb23 100644
--- a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php+++ b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php@@ -140,6 +140,10 @@ class ContactsStoreTest extends TestCase {
public function testGetContactsWithoutBinaryImage() {
/** @var IUser|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']))
@@ -163,7 +167,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() {(didn't run tests against it) |
blizzz
commented
Oct 3, 2022
@AndyXheli could you add them as commit to this PR? |
Signed-off-by: Andy Xheli <axheli@axtsolutions.com>
AndyXheli
commented
Oct 3, 2022
@blizzz All done :) |
blizzz
commented
Oct 5, 2022
/backport to stable25 |
AndyXheli
commented
Oct 5, 2022
@blizzz thank you! Can we also backpo this to NC 24 ? |
blizzz
commented
Oct 5, 2022
/backport to stable24 |
szaimen
commented
Feb 15, 2023
This seemingly broke avatars of vcf-contacts. See #36735 |
AndyXheli
commented
Feb 15, 2023
szaimen
commented
Feb 15, 2023
AndyXheli
commented
Feb 15, 2023
Okay, thanks. Just checking so we did have duplicate issues. |

Signed-off-by: Andy Xheli axheli@axtsolutions.com
Before

After

Fix for #31065