Skip to content

Commit

Permalink
fix: workspace admin aren't listed in 'Preferred exporter'
Browse files Browse the repository at this point in the history
  • Loading branch information
daledah committed Jul 9, 2024
1 parent dd96852 commit 7144cd3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,12 @@ function getPersonalPolicy() {
}

function getAdminEmployees(policy: OnyxEntry<Policy>): 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);
}

/**
Expand Down

0 comments on commit 7144cd3

Please sign in to comment.