-
Notifications
You must be signed in to change notification settings - Fork 3k
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 default WS avatar is shown instead of the custom one #49145
Fix default WS avatar is shown instead of the custom one #49145
Conversation
const isSameAvatarURL = iconFromCache?.icon?.source === policyExpenseChatAvatarSource; | ||
const hasWorkSpaceNameChanged = iconFromCache?.name !== workspaceName; | ||
|
||
if (iconFromCache && (isSameAvatarURL || report?.policyAvatar === undefined) && !hasWorkSpaceNameChanged) { |
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.
I doubt why we need condition || report?.policyAvatar === undefined
, isn't isSameAvatarURL
enough?
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.
Let's say we already have a cache for workspace A custom avatar. If there is a report that has a missing policyAvatar
, then policyExpenseChatAvatarSource
will contain the default workspace avatar and override the cache.
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.
If the report policyAvatar
is missing then we are looking for the policy avatarURL
, if that is missing too then we need to set the defaultAvatar and it should update the cache. isn't it? Why do we need to return old cache value?
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.
If the policyAvatar is an empty string, then yes, we should update the cache because that means the avatar is removed, but if it's missing (undefined), then it's just missing, not that the avatar is removed.
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.
Ok, I am not sure if that case will exist or not but I Got your point 👍
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.
We've ended up using || policyAvatarURL === undefined
instead of report?.policyAvatar
to handle the offline change of the WS icon: #53618
Reviewer Checklist
Screenshots/VideosAndroid: Nativeac1.webmAndroid: mWeb Chromeac.webmiOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.-.2024-09-14.at.11.28.40.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2024-09-14.at.11.41.54.mp4MacOS: Chrome / SafariScreen.Recording.2024-09-14.at.11.14.36.movMacOS: Desktop |
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.
LGTM!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.0.36-0 🚀
|
🚀 Deployed to production by https://github.com/grgia in version: 9.0.36-2 🚀
|
Details
The WS avatar in invoice room shows a default avatar instead of the custom one.
Fixed Issues
$ #48358
PROPOSAL: #48358 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Prerequisite:
Workspace has custom avatar.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4