Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, {useCallback, useContext, useEffect, useMemo, useState} from 'reac
import {InteractionManager, View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useDuplicateTransactionsAndViolations from '@hooks/useDuplicateTransactionsAndViolations';
import useLoadingBarVisibility from '@hooks/useLoadingBarVisibility';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -181,9 +182,8 @@ function MoneyReportHeader({
| PlatformStackRouteProp<SearchFullscreenNavigatorParamList, typeof SCREENS.SEARCH.MONEY_REQUEST_REPORT>
| PlatformStackRouteProp<SearchReportParamList, typeof SCREENS.SEARCH.REPORT_RHP>
>();
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const {login: currentUserLogin} = useCurrentUserPersonalDetails();
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${moneyRequestReport?.chatReportID}`, {canBeMissing: true});
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const [nextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${moneyRequestReport?.reportID}`, {canBeMissing: true});
const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: isUserValidatedSelector, canBeMissing: true});
const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`, {canBeMissing: true});
Expand Down Expand Up @@ -537,6 +537,7 @@ function MoneyReportHeader({

const primaryAction = useMemo(() => {
return getReportPrimaryAction({
currentUserEmail: currentUserLogin ?? '',
report: moneyRequestReport,
chatReport,
reportTransactions: transactions,
Expand All @@ -561,6 +562,7 @@ function MoneyReportHeader({
reportActions,
isChatReportArchived,
invoiceReceiverPolicy,
currentUserLogin,
]);

const confirmExport = useCallback(() => {
Expand Down Expand Up @@ -833,6 +835,7 @@ function MoneyReportHeader({
return [];
}
return getSecondaryReportActions({
currentUserEmail: currentUserLogin ?? '',
report: moneyRequestReport,
chatReport,
reportTransactions: transactions,
Expand All @@ -843,7 +846,7 @@ function MoneyReportHeader({
policies,
isChatReportArchived,
});
}, [moneyRequestReport, transactions, violations, policy, reportNameValuePairs, reportActions, policies, chatReport, isChatReportArchived]);
}, [moneyRequestReport, transactions, violations, policy, reportNameValuePairs, reportActions, policies, chatReport, isChatReportArchived, currentUserLogin]);

const secondaryExportActions = useMemo(() => {
if (!moneyRequestReport) {
Expand Down
10 changes: 6 additions & 4 deletions src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, {useCallback, useContext, useEffect, useMemo, useState} from 'reac
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useDuplicateTransactionsAndViolations from '@hooks/useDuplicateTransactionsAndViolations';
import useLoadingBarVisibility from '@hooks/useLoadingBarVisibility';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -100,6 +101,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre
const styles = useThemeStyles();
const theme = useTheme();
const {translate} = useLocalize();
const {login: currentUserLogin} = useCurrentUserPersonalDetails();
const isOnHold = isOnHoldTransactionUtils(transaction);
const isDuplicate = isDuplicateTransactionUtils(transaction);
const reportID = report?.reportID;
Expand Down Expand Up @@ -180,8 +182,8 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre
if (!report || !parentReport || !transaction) {
return '';
}
return getTransactionThreadPrimaryAction(report, parentReport, transaction, transactionViolations, policy, isFromReviewDuplicates);
}, [parentReport, policy, report, transaction, transactionViolations, isFromReviewDuplicates]);
return getTransactionThreadPrimaryAction(currentUserLogin ?? '', report, parentReport, transaction, transactionViolations, policy, isFromReviewDuplicates);
}, [parentReport, policy, report, transaction, transactionViolations, isFromReviewDuplicates, currentUserLogin]);

const primaryActionImplementation = {
[CONST.REPORT.TRANSACTION_PRIMARY_ACTIONS.REMOVE_HOLD]: (
Expand Down Expand Up @@ -250,8 +252,8 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre
if (!transaction || !reportActions) {
return [];
}
return getSecondaryTransactionThreadActions(parentReport, transaction, Object.values(reportActions), policy, report);
}, [report, parentReport, policy, transaction]);
return getSecondaryTransactionThreadActions(currentUserLogin ?? '', parentReport, transaction, Object.values(reportActions), policy, report);
}, [report, parentReport, policy, transaction, currentUserLogin]);

const dismissModalAndUpdateUseReject = () => {
setIsRejectEducationalModalVisible(false);
Expand Down
46 changes: 9 additions & 37 deletions src/libs/ReportPrimaryActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
import {getSession} from './SessionUtils';
import {
allHavePendingRTERViolation,
getTransactionViolations,
hasPendingRTERViolation as hasPendingRTERViolationTransactionUtils,
isDuplicate,
isOnHold as isOnHoldTransactionUtils,
Expand All @@ -52,6 +51,7 @@ import {
} from './TransactionUtils';

type GetReportPrimaryActionParams = {
currentUserEmail: string;
report: Report | undefined;
chatReport: OnyxEntry<Report>;
reportTransactions: Transaction[];
Expand Down Expand Up @@ -275,7 +275,7 @@ function isReviewDuplicatesAction(report: Report, reportTransactions: Transactio
return false;
}

function isMarkAsCashAction(report: Report, reportTransactions: Transaction[], violations: OnyxCollection<TransactionViolation[]>, policy?: Policy) {
function isMarkAsCashAction(currentUserEmail: string, report: Report, reportTransactions: Transaction[], violations: OnyxCollection<TransactionViolation[]>, policy?: Policy) {
const isOneExpenseReport = isExpenseReportUtils(report) && reportTransactions.length === 1;

if (!isOneExpenseReport) {
Expand All @@ -290,43 +290,14 @@ function isMarkAsCashAction(report: Report, reportTransactions: Transaction[], v
}

const isReportSubmitter = isCurrentUserSubmitter(report);
const isReportApprover = isApproverUtils(policy, getCurrentUserAccountID());
const isReportApprover = isApproverUtils(policy, currentUserEmail);
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;

const shouldShowBrokenConnectionViolation = shouldShowBrokenConnectionViolationForMultipleTransactions(transactionIDs, report, policy, violations);
const userControlsReport = isReportSubmitter || isReportApprover || isAdmin;
return userControlsReport && shouldShowBrokenConnectionViolation;
}

function isMarkAsResolvedReportAction(
report: Report,
chatReport: OnyxEntry<Report>,
reportTransactions?: Transaction[],
violations?: OnyxCollection<TransactionViolation[]>,
policy?: Policy,
reportActions?: ReportAction[],
) {
if (!report || !reportTransactions || !violations) {
return false;
}

const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions);
const isOneExpenseReport = reportTransactions.length === 1;
const transaction = reportTransactions.at(0);

if ((!!reportActions && !transactionThreadReportID) || !isOneExpenseReport || !transaction) {
return false;
}

const isReportSubmitter = isCurrentUserSubmitter(report);
const isAdmin = isPolicyAdminPolicyUtils(policy);
if (!isReportSubmitter && !isAdmin) {
return false;
}

return getTransactionViolations(transaction, violations)?.some((violation) => violation.name === CONST.VIOLATIONS.AUTO_REPORTED_REJECTED_EXPENSE);
}

function isMarkAsResolvedAction(report?: Report, violations?: TransactionViolation[], policy?: Policy) {
if (!report || !violations) {
return false;
Expand All @@ -351,6 +322,7 @@ function getAllExpensesToHoldIfApplicable(report?: Report, reportActions?: Repor

function getReportPrimaryAction(params: GetReportPrimaryActionParams): ValueOf<typeof CONST.REPORT.PRIMARY_ACTIONS> | '' {
const {
currentUserEmail,
report,
reportTransactions,
violations,
Expand All @@ -376,7 +348,7 @@ function getReportPrimaryAction(params: GetReportPrimaryActionParams): ValueOf<t

const isPayActionWithAllExpensesHeld = isPrimaryPayAction(report, policy, reportNameValuePairs, isChatReportArchived) && hasOnlyHeldExpenses(report?.reportID);

if (isMarkAsCashAction(report, reportTransactions, violations, policy)) {
if (isMarkAsCashAction(currentUserEmail, report, reportTransactions, violations, policy)) {
return CONST.REPORT.PRIMARY_ACTIONS.MARK_AS_CASH;
}

Expand Down Expand Up @@ -411,7 +383,7 @@ function getReportPrimaryAction(params: GetReportPrimaryActionParams): ValueOf<t
return '';
}

function isMarkAsCashActionForTransaction(parentReport: Report, violations: TransactionViolation[], policy?: Policy): boolean {
function isMarkAsCashActionForTransaction(currentUserLogin: string, parentReport: Report, violations: TransactionViolation[], policy?: Policy): boolean {
const hasPendingRTERViolation = hasPendingRTERViolationTransactionUtils(violations);

if (hasPendingRTERViolation) {
Expand All @@ -425,13 +397,14 @@ function isMarkAsCashActionForTransaction(parentReport: Report, violations: Tran
}

const isReportSubmitter = isCurrentUserSubmitter(parentReport);
const isReportApprover = isApproverUtils(policy, getCurrentUserAccountID());
const isReportApprover = isApproverUtils(policy, currentUserLogin);
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;

return isReportSubmitter || isReportApprover || isAdmin;
}

function getTransactionThreadPrimaryAction(
currentUserLogin: string,
transactionThreadReport: Report,
parentReport: Report,
reportTransaction: Transaction,
Expand All @@ -451,7 +424,7 @@ function getTransactionThreadPrimaryAction(
return isFromReviewDuplicates ? CONST.REPORT.TRANSACTION_PRIMARY_ACTIONS.KEEP_THIS_ONE : CONST.REPORT.TRANSACTION_PRIMARY_ACTIONS.REVIEW_DUPLICATES;
}

if (isMarkAsCashActionForTransaction(parentReport, violations, policy)) {
if (isMarkAsCashActionForTransaction(currentUserLogin, parentReport, violations, policy)) {
return CONST.REPORT.TRANSACTION_PRIMARY_ACTIONS.MARK_AS_CASH;
}

Expand All @@ -465,7 +438,6 @@ export {
isPrimaryPayAction,
isExportAction,
isMarkAsResolvedAction,
isMarkAsResolvedReportAction,
getAllExpensesToHoldIfApplicable,
isReviewDuplicatesAction,
};
20 changes: 12 additions & 8 deletions src/libs/ReportSecondaryActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function isSubmitAction(
return !!isScheduledSubmitEnabled || primaryAction !== CONST.REPORT.SECONDARY_ACTIONS.SUBMIT;
}

function isApproveAction(report: Report, reportTransactions: Transaction[], violations: OnyxCollection<TransactionViolation[]>, policy?: Policy): boolean {
function isApproveAction(currentUserLogin: string, report: Report, reportTransactions: Transaction[], violations: OnyxCollection<TransactionViolation[]>, policy?: Policy): boolean {
const isAnyReceiptBeingScanned = reportTransactions?.some((transaction) => isReceiptBeingScanned(transaction));

if (isAnyReceiptBeingScanned) {
Expand Down Expand Up @@ -236,14 +236,14 @@ function isApproveAction(report: Report, reportTransactions: Transaction[], viol
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;

const shouldShowBrokenConnectionViolation = shouldShowBrokenConnectionViolationForMultipleTransactions(transactionIDs, report, policy, violations);
const isReportApprover = isApproverUtils(policy, currentUserAccountID);
const isReportApprover = isApproverUtils(policy, currentUserLogin);
const userControlsReport = isReportApprover || isAdmin;
return userControlsReport && shouldShowBrokenConnectionViolation;
}

function isUnapproveAction(report: Report, policy?: Policy): boolean {
function isUnapproveAction(currentUserLogin: string, report: Report, policy?: Policy): boolean {
const isExpenseReport = isExpenseReportUtils(report);
const isReportApprover = isApproverUtils(policy, getCurrentUserAccountID());
const isReportApprover = isApproverUtils(policy, currentUserLogin);
const isReportApproved = isReportApprovedUtils({report});
const isReportSettled = isSettled(report);
const isPaymentProcessing = report.isWaitingOnBankAccount && report.statusNum === CONST.REPORT.STATUS_NUM.APPROVED;
Expand Down Expand Up @@ -558,6 +558,7 @@ function isRemoveHoldActionForTransaction(report: Report, reportTransaction: Tra
}

function getSecondaryReportActions({
currentUserEmail,
report,
chatReport,
reportTransactions,
Expand All @@ -568,6 +569,7 @@ function getSecondaryReportActions({
policies,
isChatReportArchived = false,
}: {
currentUserEmail: string;
report: Report;
chatReport: OnyxEntry<Report>;
reportTransactions: Transaction[];
Expand All @@ -590,6 +592,7 @@ function getSecondaryReportActions({
}

const primaryAction = getReportPrimaryAction({
currentUserEmail,
report,
chatReport,
reportTransactions,
Expand All @@ -604,11 +607,11 @@ function getSecondaryReportActions({
options.push(CONST.REPORT.SECONDARY_ACTIONS.SUBMIT);
}

if (isApproveAction(report, reportTransactions, violations, policy)) {
if (isApproveAction(currentUserEmail, report, reportTransactions, violations, policy)) {
options.push(CONST.REPORT.SECONDARY_ACTIONS.APPROVE);
}

if (isUnapproveAction(report, policy)) {
if (isUnapproveAction(currentUserEmail, report, policy)) {
options.push(CONST.REPORT.SECONDARY_ACTIONS.UNAPPROVE);
}

Expand All @@ -632,7 +635,7 @@ function getSecondaryReportActions({
options.push(CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD);
}

if (canRejectReportAction(report, policy)) {
if (canRejectReportAction(currentUserEmail, report, policy)) {
options.push(CONST.REPORT.SECONDARY_ACTIONS.REJECT);
}

Expand Down Expand Up @@ -686,6 +689,7 @@ function getSecondaryExportReportActions(report: Report, policy?: Policy, export
}

function getSecondaryTransactionThreadActions(
currentUserEmail: string,
parentReport: Report,
reportTransaction: Transaction,
reportActions: ReportAction[],
Expand All @@ -702,7 +706,7 @@ function getSecondaryTransactionThreadActions(
options.push(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REMOVE_HOLD);
}

if (canRejectReportAction(parentReport, policy)) {
if (canRejectReportAction(currentUserEmail, parentReport, policy)) {
options.push(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT);
}

Expand Down
4 changes: 2 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@
const parsedReportActionMessageCache: Record<string, string> = {};

let conciergeReportID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 930 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportID = value;
Expand All @@ -935,7 +935,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 938 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -953,7 +953,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 956 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -965,14 +965,14 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 968 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
});

let allPolicies: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 975 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => (allPolicies = value),
Expand All @@ -980,7 +980,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 983 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1021,14 +1021,14 @@
});

let allBetas: OnyxEntry<Beta[]>;
Onyx.connect({

Check warning on line 1024 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: OnyxCollection<Transaction> = {};
let reportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1031 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1054,7 +1054,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1057 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand All @@ -1067,7 +1067,7 @@

let allReportMetadata: OnyxCollection<ReportMetadata>;
const allReportMetadataKeyValue: Record<string, ReportMetadata> = {};
Onyx.connect({

Check warning on line 1070 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_METADATA,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -11563,12 +11563,12 @@
};
}

function canRejectReportAction(report: Report, policy?: Policy): boolean {
function canRejectReportAction(currentUserLogin: string, report: Report, policy?: Policy): boolean {
if (!Permissions.isBetaEnabled(CONST.BETAS.NEWDOT_REJECT, allBetas)) {
return false;
}

const isReportApprover = isApproverUtils(policy, currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID);
const isReportApprover = isApproverUtils(policy, currentUserLogin);
const isReportBeingProcessed = isProcessingReport(report);
const isReportPayer = isPayer(getSession(), report, false, policy);
const isIOU = isIOUReport(report);
Expand Down
10 changes: 8 additions & 2 deletions src/libs/actions/Policy/Member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ Onyx.connect({
});

/** Check if the passed employee is an approver in the policy's employeeList */
function isApprover(policy: OnyxEntry<Policy>, employeeAccountID: number) {
const employeeLogin = allPersonalDetails?.[employeeAccountID]?.login;
function isApprover(policy: OnyxEntry<Policy>, employeeLogin: string) {
if (policy?.approver === employeeLogin) {
return true;
}
Expand All @@ -134,6 +133,12 @@ function isApprover(policy: OnyxEntry<Policy>, employeeAccountID: number) {
);
}

/** Temporary function alias for isApprover with employeeAccountID */
function isApproverTemp(policy: OnyxEntry<Policy>, employeeAccountID: number) {
Comment thread
shubham1206agra marked this conversation as resolved.
const employeeLogin = allPersonalDetails?.[employeeAccountID]?.login;
return isApprover(policy, employeeLogin ?? '');
}

/**
* Returns the policy of the report
* @deprecated Get the data straight from Onyx - This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
Expand Down Expand Up @@ -1385,4 +1390,5 @@ export {
clearWorkspaceInviteRoleDraft,
setImportedSpreadsheetMemberData,
clearImportedSpreadsheetMemberData,
isApproverTemp,
};
6 changes: 3 additions & 3 deletions src/pages/workspace/WorkspaceMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
clearInviteDraft,
clearWorkspaceOwnerChangeFlow,
downloadMembersCSV,
isApprover,
isApproverTemp,
openWorkspaceMembersPage,
removeMembers,
updateWorkspaceMembersRole,
Expand Down Expand Up @@ -158,7 +158,7 @@ function WorkspaceMembersPage({personalDetails, route, policy}: WorkspaceMembers
const canSelectMultiple = isPolicyAdmin && (shouldUseNarrowLayout ? isMobileSelectionModeEnabled : true);

const confirmModalPrompt = useMemo(() => {
const approverAccountID = selectedEmployees.find((selectedEmployee) => isApprover(policy, selectedEmployee));
const approverAccountID = selectedEmployees.find((selectedEmployee) => isApproverTemp(policy, selectedEmployee));
if (!approverAccountID) {
return translate('workspace.people.removeMembersPrompt', {
count: selectedEmployees.length,
Expand Down Expand Up @@ -267,7 +267,7 @@ function WorkspaceMembersPage({personalDetails, route, policy}: WorkspaceMembers
const accountIDsToRemove = session?.accountID ? selectedEmployees.filter((id) => id !== session.accountID) : selectedEmployees;

// Check if any of the account IDs are approvers
const hasApprovers = accountIDsToRemove.some((accountID) => isApprover(policy, accountID));
const hasApprovers = accountIDsToRemove.some((accountID) => isApproverTemp(policy, accountID));

if (hasApprovers) {
const ownerEmail = ownerDetails.login;
Expand Down
Loading
Loading