From 7144cd3c7f61dd03d3b06daf74b5ea5287354458 Mon Sep 17 00:00:00 2001 From: daledah Date: Tue, 9 Jul 2024 16:33:07 +0700 Subject: [PATCH] fix: workspace admin aren't listed in 'Preferred exporter' --- src/libs/PolicyUtils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index fc9a04e2507c..85b98bf0d487 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -413,7 +413,12 @@ function getPersonalPolicy() { } function getAdminEmployees(policy: OnyxEntry): PolicyEmployee[] { - return Object.values(policy?.employeeList ?? {}).filter((employee) => employee.role === CONST.POLICY.ROLE.ADMIN); + if (!policy || !policy.employeeList) { + return []; + } + return Object.keys(policy.employeeList) + .map((email) => ({...policy.employeeList?.[email], email})) + .filter((employee) => employee.role === CONST.POLICY.ROLE.ADMIN); } /**