HomePhabricator
Diffusion Comm b5df71ba24a0

[lib] introduce getAvatarForUser in avatar-utils

Description

[lib] introduce getAvatarForUser in avatar-utils

Summary:
Introduce getAvatarForUser in avatar-utils. getAvatarForUser is a function that checks if a user has an avatar, and either returns that or randomly generates an emoji avatar for the user and returns that. We generate an emoji avatar based on the user's username. If the user does not have a username set, we just default to an avatar with this emoji 👤 for the user.

This diff won't be landed until there is a feature flag for the avatars work


Linear Task: https://linear.app/comm/issue/ENG-3257/create-function-to-automatically-select-an-emoji-avatar-for-users-with

Test Plan:
I rendered the avatar (coming later in the stack) and checked to make sure the default emoji avatars didn't change for the same user

Ginsu's friends list

Screenshot 2023-03-13 at 1.22.55 AM.png (396×754 px, 70 KB)

Dan's avatar

Screenshot 2023-03-13 at 1.43.52 AM.png (1×1 px, 401 KB)

Ryan's avatar

Screenshot 2023-03-13 at 1.44.06 AM.png (1×1 px, 405 KB)

Unknown user:

Screenshot 2023-03-14 at 11.06.36 AM.png (1×1 px, 382 KB)

Reviewers: ashoat, atul

Reviewed By: ashoat

Subscribers: varun, ashoat, tomek, atul

Differential Revision: https://phab.comm.dev/D7053

Details

Provenance
ginsuAuthored on Mar 21 2023, 8:34 AM
Reviewer
ashoat
Differential Revision
D7053: [lib] introduce getAvatarForUser in avatar-utils
Parents
rCOMMfa13b21baf73: [Comm-opaque2] Add wasm build to client
Branches
Unknown
Tags
Unknown