Fix for updating avatar logic#72556
Conversation
|
|
| } else if (accountEmail) { | ||
| const intVal = parseInt(md5(accountEmail, {asString: true}).substring(0, 4), 10); | ||
| accountIDHashBucket = ((intVal % CONST.DEFAULT_AVATAR_COUNT) + 1) as AvatarRange; |
There was a problem hiding this comment.
When I first built the default avatars into NewDot, we used email to hash these. But then we changed it to accountID because of Hidden users. It makes sense now to use email again if you know the email, but wondering if this precedence will have any side effects.
There was a problem hiding this comment.
My question is, which are should we should use as the default if we have both
There was a problem hiding this comment.
We also have users with phone login I think...
Not sure how we generate avatars for them on BE
The idea in my implementation is to use email if we have it fallback to id if we do not
| "node_modules/@types/md5": { | ||
| "version": "2.3.5", | ||
| "resolved": "https://registry.npmjs.org/@types/md5/-/md5-2.3.5.tgz", | ||
| "integrity": "sha512-/i42wjYNgE6wf0j2bcTX6kuowmdL/6PE4IVitMpm2eYKBUuYCprdcWVK+xEF0gcV6ufMCRhtxmReGfc6hIK7Jw==", | ||
| "dev": true, | ||
| "license": "MIT" |
There was a problem hiding this comment.
I'm assuming this is different, but I haven't imported one from common before. Is this a different one?
There was a problem hiding this comment.
I just didn't know that we have it, will change to the one from expensify-common
There was a problem hiding this comment.
updated to use expensify-common one
grgia
left a comment
There was a problem hiding this comment.
Design is going to be so happy with this one too
|
I'll review this |
|
@dominictb give me like 10 more minutes - changing the md5 lib |
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 8 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@dominictb Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
|
@jmusial Can you merge main to make sure there's no new usage of the changed functions? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-10-22.at.18.34.50.movAndroid: mWeb ChromeScreen.Recording.2025-10-22.at.18.36.52.moviOS: HybridAppScreen.Recording.2025-10-22.at.18.31.03.moviOS: mWeb SafariScreen.Recording.2025-10-22.at.18.32.40.movMacOS: Chrome / SafariScreen.Recording.2025-10-22.at.18.23.23.movMacOS: Desktop |
|
🚀 Deployed to staging by https://github.com/grgia in version: 9.2.37-1 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.2.37-8 🚀
|
Explanation of Change
There was a difference default avatar generation logic between FE and BE. This PR aligns that logic. It now prefers email as a source for default avatar bucket generation.
Before
after.mov
After
before.mov
Fixed Issues
$ #71288
PROPOSAL:
Tests
Pre requisite:
customAvatarsbeta enabledOffline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
0054.andorid.native.mov
Android: mWeb Chrome
0054.andorid.chrome.mov
iOS: Native
0054.ios.native.mov
iOS: mWeb Safari
0054.ios.safari.mov
MacOS: Chrome / Safari
0054.desktop.chrome.mov
MacOS: Desktop
0054.desktop.native.mov