Skip to content

Commit

Permalink
Merge pull request #44654 from Expensify/yuwen-ownerDeets
Browse files Browse the repository at this point in the history
[CP staging] Use policy owner details in employee removal confirmation modal
  • Loading branch information
yuwenmemon authored Jun 29, 2024
2 parents 360af2b + 6de207a commit 4622e19
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
const isSelectedMemberCurrentUser = accountID === currentUserPersonalDetails?.accountID;
const isCurrentUserAdmin = policy?.employeeList?.[personalDetails?.[currentUserPersonalDetails?.accountID]?.login ?? '']?.role === CONST.POLICY.ROLE.ADMIN;
const isCurrentUserOwner = policy?.owner === currentUserPersonalDetails?.login;
const ownerDetails = personalDetails?.[policy?.ownerAccountID ?? -1] ?? ({} as PersonalDetails);
const policyOwnerDisplayName = ownerDetails.displayName ?? policy?.owner ?? '';

const confirmModalPrompt = useMemo(() => {
const isApprover = Member.isApprover(policy, accountID);
if (!isApprover) {
translate('workspace.people.removeMemberPrompt', {memberName: displayName});
}
return translate('workspace.people.removeMembersWarningPrompt', {memberName: displayName, ownerName: policy?.owner ?? ''});
}, [accountID, policy, displayName, translate]);
return translate('workspace.people.removeMembersWarningPrompt', {memberName: displayName, ownerName: policyOwnerDisplayName});
}, [accountID, policy, displayName, policyOwnerDisplayName, translate]);

const roleItems: ListItemType[] = useMemo(
() => [
Expand Down

0 comments on commit 4622e19

Please sign in to comment.