Skip to content
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

feat: Fetch avatars using user id #33214

Merged
merged 11 commits into from
Nov 19, 2024
Merged

feat: Fetch avatars using user id #33214

merged 11 commits into from
Nov 19, 2024

Conversation

gabriellsh
Copy link
Member

@gabriellsh gabriellsh commented Sep 5, 2024

Proposed changes (including videos or screenshots)

Created a new route <workspace>/avatar/uid/<userID> which allows fetching avatars using the user's ID instead of just using username.

This is being done to help improve performance in places where we only have access to user id. This way we avoid making an API call just to get the user's username.

This route will also return the generated SVG avatars (Initial letter with colored background) but does not allow using @ to force returning this fallback, since a userID is expected and the fallback is based on username/name.

Issue(s)

CORE-673

Steps to test or reproduce

Further comments

Copy link
Contributor

dionisio-bot bot commented Sep 5, 2024

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Sep 5, 2024

🦋 Changeset detected

Latest commit: ebb5e49

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 35 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/core-typings Minor
@rocket.chat/rest-typings Minor
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/gazzodown Major
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Major
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker Patch
@rocket.chat/models Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-client Major
@rocket.chat/ui-video-conf Major
@rocket.chat/ui-voip Major
@rocket.chat/web-ui-registration Major
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 96.64430% with 5 lines in your changes missing coverage. Please review.

Project coverage is 75.88%. Comparing base (b6f9110) to head (ebb5e49).
Report is 6 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #33214      +/-   ##
===========================================
+ Coverage    75.73%   75.88%   +0.14%     
===========================================
  Files          507      507              
  Lines        21799    21938     +139     
  Branches      5343     5351       +8     
===========================================
+ Hits         16509    16647     +138     
  Misses        4648     4648              
- Partials       642      643       +1     
Flag Coverage Δ
unit 75.88% <96.64%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

---- 🚨 Try these New Features:

@gabriellsh gabriellsh marked this pull request as ready for review September 9, 2024 19:37
@gabriellsh gabriellsh requested a review from a team as a code owner September 9, 2024 19:37
Copy link
Contributor

github-actions bot commented Sep 11, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-33214/
on branch gh-pages at 2024-11-19 21:03 UTC

Copy link
Member

@sampaiodiego sampaiodiego left a comment

Choose a reason for hiding this comment

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

very small code style suggestions

apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
sampaiodiego
sampaiodiego previously approved these changes Sep 16, 2024
Copy link
Member

@sampaiodiego sampaiodiego left a comment

Choose a reason for hiding this comment

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

I was wondering how we could add tests for avatar endpoints. any ideas?

@gabriellsh
Copy link
Member Author

I was wondering how we could add tests for avatar endpoints. any ideas?

I was very unsure about how to proceed with tests, but I think I can make some end-to-end cases (I found some tests for assets so I think they should be similar). I'll do them whenever I can, reverting this to draft for now.

@gabriellsh gabriellsh marked this pull request as draft September 23, 2024 16:46
apps/meteor/server/routes/avatar/middlewares/auth.js Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.js Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
apps/meteor/server/routes/avatar/user.ts Outdated Show resolved Hide resolved
@gabriellsh gabriellsh marked this pull request as ready for review October 31, 2024 18:59
@gabriellsh gabriellsh requested a review from a team as a code owner October 31, 2024 18:59
@gabriellsh gabriellsh added this to the 7.1.0 milestone Nov 7, 2024
@MarcosSpessatto MarcosSpessatto added the stat: QA assured Means it has been tested and approved by a company insider label Nov 8, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Nov 8, 2024
@ggazzo ggazzo merged commit eccd40d into develop Nov 19, 2024
8 of 9 checks passed
@ggazzo ggazzo deleted the fetchAvatarById branch November 19, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants