Open IuliiaHerets opened 9 hours ago
Triggered auto assignment to @JmillsExpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Workspace - Workspace chat shows default avatar when custom avatar is uploaded offline
When we set workspace avatar in offline personalDetails?.[report?.ownerAccountID ?? -1]?.avatar
here will be undefined
=> icon here will be default avatar
We should pass policy?.avatar
as fallback in here
source: personalDetails?.[report?.ownerAccountID ?? -1]?.avatar ?? policy?.avatarURL ?? FallbackAvatar,
NA
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
The workspace avatar in workspace chat shows default avatar when custom avatar is uploaded offline.
When setting the workspace avatar, we only update policy avatarUrl
So in getWorkspaceIcon
function, we will return iconFromCache.icon
When setting the workspace avatar, we need to update the expense chat report policy avatar URL too
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${getPolicyExpenseChat(accountID, policy?.id ?? '-1')?.reportID ?? '-1'}`,
value: {
policyAvatar: file.uri,
},
},
And will set to default in failureData
NA
WS chat shows default WS avatar.
When we create a new workspace, the avatar is initially a default avatar. When we change the avatar, the avatar URL is changed in the onyx. However, the icon returns the cached avatar, that is the default avatar. https://github.com/Expensify/App/blob/60e9c7c69fa37a6fd320ea94d6b6047dc718d783/src/libs/ReportUtils.ts#L2059-L2073
isSameAvatarURL
is false, but report?.policyAvatar === undefined
is true, so we return the cache. The reason we added report?.policyAvatar === undefined
is explained here.
The reason is, if we receive an invoice from a workspace that we don't have the data, the only way to get the avatar source is from the invoice report policyAvatar
. This avatar is then cached. But just in case there is another report that is related to that invoice policy with missing policyAvatar
, the avatar will be the default avatar and we don't want to replace the cached avatar with the default avatar.
But in this issue, report?.policyAvatar
is undefined, but we have the policy data avatarURL
.
To fix this, we should use the cache if both report?.policyAvatar
and policy avatarURL
are missing (undefined).
if (iconFromCache && (isSameAvatarURL || !policyAvatarURL) && !hasWorkSpaceNameChanged) {
return iconFromCache.icon;
}
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.68-0 Reproducible in staging?: Y Reproducible in production?: Y Issue was found when executing this PR https://github.com/Expensify/App/pull/53100 Email or phone of affected tester (no customers): applausetester+232803@applause.expensifail.com Issue reported by: Applause Internal
Action Performed:
Expected Result:
The workspace avatar in workspace chat should show the custom avatar.
Actual Result:
The workspace avatar in workspace chat shows default avatar when custom avatar is uploaded offline.
Workspace switcher shows the custom avatar instead of default avatar for the workspace.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/2e4fce97-bf55-4db5-8d68-0cc1bfea79bf
View all open jobs on GitHub