Skip to content

Display avatars in user search#4939

Merged
ThiefMaster merged 5 commits intoindico:masterfrom
tomasr8:search-avatars
Jun 9, 2021
Merged

Display avatars in user search#4939
ThiefMaster merged 5 commits intoindico:masterfrom
tomasr8:search-avatars

Conversation

@tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Jun 9, 2021

When searching users, instead of the default icon, avatars are displayed.
If the user does not have an avatar, the default avatar with the first letter of
the first name is used.

The group search still displays the default result icon.

Before:
Screenshot from 2021-06-08 16-41-21
After:
Screenshot from 2021-06-08 18-07-55
Screenshot from 2021-06-09 10-47-43

tomasr8 added 2 commits June 9, 2021 10:51
The `avatar_url` field is added to results from `/user/search`
and from `/api/principals`. The modification of the second
endpoint is needed because the results are used by the user search
modal.

The `avatar_url` always contains a valid url. If the user
does not have a profile picture set, a default avatar url is
returned instead.
If the user has set a profile picture, it will
be displayed in the search result instead of
the default result icon.

This change only affects user search even though
the code is shared between users and groups. Groups
still use the default `resultIcon` passed to `SearchFactory`,
if the `avatarURL` field of the search result does not exist.
@tomasr8 tomasr8 requested a review from ThiefMaster June 9, 2021 09:39
Copy link
Member

@ThiefMaster ThiefMaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it locally and it works great! :) Just one more small naming suggestion...

@ThiefMaster ThiefMaster merged commit 9a23f94 into indico:master Jun 9, 2021
@ThiefMaster ThiefMaster deleted the search-avatars branch June 9, 2021 13:06
pferreir pushed a commit to pferreir/indico that referenced this pull request Oct 12, 2021
* Add `avatar_url` to user search results

The `avatar_url` field is added to results from `/user/search`
and from `/api/principals`. The modification of the second
endpoint is needed because the results are used by the user search
modal.

* Show avatars in user search

If the user has set a profile picture, it will
be displayed in the search result instead of
the default result icon.

This change only affects user search even though
the code is shared between users and groups. Groups
still use the default `resultIcon` passed to `SearchFactory`,
if the `avatarURL` field of the search result does not exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants