diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 568ce49ff961..cb806fa43620 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1458,9 +1458,11 @@ function getIconsForParticipants(participants: number[], personalDetails: OnyxCo */ function getWorkspaceIcon(report: OnyxEntry, policy: OnyxEntry = null): Icon { const workspaceName = getPolicyName(report, false, policy); - const policyExpenseChatAvatarSource = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar - ? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar - : getDefaultWorkspaceAvatar(workspaceName); + // disabling to protect against empty strings + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const policyAvatarURL = report?.policyAvatar || allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const policyExpenseChatAvatarSource = policyAvatarURL || getDefaultWorkspaceAvatar(workspaceName); const workspaceIcon: Icon = { source: policyExpenseChatAvatarSource ?? '', diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index bfe27910c943..d903bc10bbf7 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -205,6 +205,7 @@ function ReportScreen({ visibility: reportProp.visibility, oldPolicyName: reportProp.oldPolicyName, policyName: reportProp.policyName, + policyAvatar: reportProp.policyAvatar, isOptimisticReport: reportProp.isOptimisticReport, }), [ @@ -241,6 +242,7 @@ function ReportScreen({ reportProp.visibility, reportProp.oldPolicyName, reportProp.policyName, + reportProp.policyAvatar, reportProp.isOptimisticReport, ], ); diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index d26bdd4f282e..f7493480273a 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -64,6 +64,9 @@ type Report = { /** The current user's notification preference for this report */ notificationPreference?: NotificationPreference; + /** The policy avatar to use, if any */ + policyAvatar?: string | null; + /** The policy name to use */ policyName?: string | null;