From b916bc3e7a146c68e1a583c6a63a88e58750b534 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Tue, 20 Jun 2023 16:19:48 -0600 Subject: [PATCH] Merge pull request #21150 from Expensify/aldo_fix-crash-invite-workspace-new-account personalDetails.login can be missing for new accounts (cherry picked from commit 0140a14016480f73d8fca7f48c5a05f872fbc997) --- src/pages/workspace/WorkspaceMembersPage.js | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js index 8f67cc0c35dc..7328459b358a 100644 --- a/src/pages/workspace/WorkspaceMembersPage.js +++ b/src/pages/workspace/WorkspaceMembersPage.js @@ -369,6 +369,7 @@ class WorkspaceMembersPage extends React.Component { {this.props.translate('common.admin')} )} +<<<<<<< HEAD {!_.isEmpty(this.state.errors[item.accountID]) && ( ); +======= + + ); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [selectedEmployees, errors, props.session.email, dismissError, toggleUser], + ); + + const policyOwner = lodashGet(props.policy, 'owner'); + const currentUserLogin = lodashGet(props.currentUserPersonalDetails, 'login'); + const removableMembers = {}; + let data = []; + _.each(props.policyMembers, (policyMember, accountID) => { + if (isDeletedPolicyMember(policyMember)) { + return; + } + const details = props.personalDetails[accountID]; + if (!details) { + Log.hmmm(`[WorkspaceMembersPage] no personal details found for policy member with accountID: ${accountID}`); + return; + } + data.push({ + ...policyMember, + ...details, + }); + }); + data = _.sortBy(data, (value) => value.displayName.toLowerCase()); + data = getMemberOptions(data, searchValue.trim().toLowerCase()); + + // If this policy is owned by Expensify then show all support (expensify.com or team.expensify.com) emails + // We don't want to show guides as policy members unless the user is a guide. Some customers get confused when they + // see random people added to their policy, but guides having access to the policies help set them up. + if (policyOwner && currentUserLogin && !PolicyUtils.isExpensifyTeam(policyOwner) && !PolicyUtils.isExpensifyTeam(currentUserLogin)) { + data = _.reject(data, (member) => PolicyUtils.isExpensifyTeam(member.login || member.displayName)); +>>>>>>> 0140a14016 (Merge pull request #21150 from Expensify/aldo_fix-crash-invite-workspace-new-account) } render() {