From a66319ca3eb3f065c41b1d2748bc2bfc8a169bf4 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Wed, 13 Dec 2023 11:46:21 -0800 Subject: [PATCH 1/3] use || instead of ?? to prevent greyed out icon --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 63037416c923..a29d5b93f4e8 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1211,7 +1211,7 @@ function getDefaultWorkspaceAvatar(workspaceName?: string): React.FC { function getWorkspaceAvatar(report: OnyxEntry): UserUtils.AvatarSource { const workspaceName = getPolicyName(report, false, allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]); - return allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar ?? getDefaultWorkspaceAvatar(workspaceName); + return allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar || getDefaultWorkspaceAvatar(workspaceName); } /** From 99fb4abc46a3460ba543e2db8e47c4d8504fb678 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Wed, 13 Dec 2023 12:15:48 -0800 Subject: [PATCH 2/3] use linter friendly code --- src/libs/ReportUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a29d5b93f4e8..cc3392c2c105 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1211,7 +1211,8 @@ function getDefaultWorkspaceAvatar(workspaceName?: string): React.FC { function getWorkspaceAvatar(report: OnyxEntry): UserUtils.AvatarSource { const workspaceName = getPolicyName(report, false, allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]); - return allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar || getDefaultWorkspaceAvatar(workspaceName); + const avatar = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar; + return avatar ? avatar : getDefaultWorkspaceAvatar(workspaceName); } /** From 73768c45f98ef039789d8378fe14635181b73dd7 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Wed, 13 Dec 2023 13:42:11 -0800 Subject: [PATCH 3/3] more linter --- src/libs/ReportUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index cc3392c2c105..8729bb1bf957 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1211,8 +1211,8 @@ function getDefaultWorkspaceAvatar(workspaceName?: string): React.FC { function getWorkspaceAvatar(report: OnyxEntry): UserUtils.AvatarSource { const workspaceName = getPolicyName(report, false, allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]); - const avatar = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar; - return avatar ? avatar : getDefaultWorkspaceAvatar(workspaceName); + const avatar = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar ?? ''; + return !isEmpty(avatar) ? avatar : getDefaultWorkspaceAvatar(workspaceName); } /**