Skip to content

Commit

Permalink
Merge pull request #21150 from Expensify/aldo_fix-crash-invite-worksp…
Browse files Browse the repository at this point in the history
…ace-new-account

personalDetails.login can be missing for new accounts

(cherry picked from commit 0140a14)
  • Loading branch information
luacmartins authored and OSBotify committed Jun 20, 2023
1 parent b0766d8 commit b916bc3
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ class WorkspaceMembersPage extends React.Component {
<Text style={[styles.peopleBadgeText]}>{this.props.translate('common.admin')}</Text>
</View>
)}
<<<<<<< HEAD
</PressableWithFeedback>
{!_.isEmpty(this.state.errors[item.accountID]) && (
<FormHelpMessage
Expand All @@ -378,6 +379,41 @@ class WorkspaceMembersPage extends React.Component {
)}
</OfflineWithFeedback>
);
=======
</OfflineWithFeedback>
);
},
// 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() {
Expand Down

0 comments on commit b916bc3

Please sign in to comment.