-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix User profile picture when performing the search #32635
Conversation
Signed-off-by: Andy Xheli <axheli@axtsolutions.com> Before ![image](https://user-images.githubusercontent.com/59488153/140980158-b9108161-57ab-48b4-ae6f-98ec4e72775a.png) 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Signed-off-by: Andy Xheli <axheli@axtsolutions.com> Co-authored-by: Carl Schwan <carl@carlschwan.eu> Signed-off-by: Andy Xheli <axheli@axtsolutions.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
Hi all, any updates on this on being in NC 25 ? |
@andyxheli CI is unhappy: There was 1 failure:
/drone/src/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php:166 that test needs adjustements apparently |
This looks to be from the return value of |
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. |
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) |
@andyxheli could you add them as commit to this PR? |
Signed-off-by: Andy Xheli <axheli@axtsolutions.com>
@blizzz All done :) |
/backport to stable25 |
@blizzz thank you! Can we also backpo this to NC 24 ? |
/backport to stable24 |
This seemingly broke avatars of vcf-contacts. See #36735 |
Okay, thanks. Just checking so we did have duplicate issues. |
Signed-off-by: Andy Xheli axheli@axtsolutions.com
Before
After
Fix for #31065