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
1 change: 0 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,6 @@ const CONST = {
PLAID_COMPANY_CARDS: 'plaidCompanyCards',
NATIVE_CONTACT_IMPORT: 'nativeContactImport',
TRACK_FLOWS: 'trackFlows',
NEW_DOT_SPLITS: 'newDotSplits',
},
BUTTON_STATES: {
DEFAULT: 'default',
Expand Down
1 change: 0 additions & 1 deletion src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,6 @@ function MoneyReportHeader({
reportActions,
policies,
isBetaEnabled(CONST.BETAS.RETRACT_NEWDOT),
isBetaEnabled(CONST.BETAS.NEW_DOT_SPLITS),
isChatReportArchived,
);
}, [moneyRequestReport, transactions, violations, policy, reportNameValuePairs, reportActions, policies, isBetaEnabled, isChatReportArchived]);
Expand Down
6 changes: 2 additions & 4 deletions src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type {OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import useLocalize from '@hooks/useLocalize';
import usePermissions from '@hooks/usePermissions';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -91,7 +90,6 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre
const isOnHold = isOnHoldTransactionUtils(transaction);
const isDuplicate = isDuplicateTransactionUtils(transaction?.transactionID);
const reportID = report?.reportID;
const {isBetaEnabled} = usePermissions();
const {removeTransaction} = useSearchContext();

const isReportInRHP = route.name === SCREENS.SEARCH.REPORT_RHP;
Expand Down Expand Up @@ -202,8 +200,8 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre
if (!transaction || !reportActions) {
return [];
}
return getSecondaryTransactionThreadActions(parentReport, transaction, Object.values(reportActions), policy, isBetaEnabled(CONST.BETAS.NEW_DOT_SPLITS));
}, [isBetaEnabled, parentReport, policy, transaction]);
return getSecondaryTransactionThreadActions(parentReport, transaction, Object.values(reportActions), policy);
}, [parentReport, policy, transaction]);

const secondaryActionsImplementation: Record<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>, DropdownOption<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>>> = {
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD]: {
Expand Down
6 changes: 2 additions & 4 deletions src/libs/ReportSecondaryActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ function getSecondaryReportActions(
reportActions?: ReportAction[],
policies?: OnyxCollection<Policy>,
canUseRetractNewDot?: boolean,
canUseNewDotSplits?: boolean,
isChatReportArchived = false,
): Array<ValueOf<typeof CONST.REPORT.SECONDARY_ACTIONS>> {
const options: Array<ValueOf<typeof CONST.REPORT.SECONDARY_ACTIONS>> = [];
Expand Down Expand Up @@ -542,7 +541,7 @@ function getSecondaryReportActions(
options.push(CONST.REPORT.SECONDARY_ACTIONS.HOLD);
}

if (canUseNewDotSplits && isSplitAction(report, reportTransactions, policy)) {
if (isSplitAction(report, reportTransactions, policy)) {
options.push(CONST.REPORT.SECONDARY_ACTIONS.SPLIT);
}

Expand All @@ -568,15 +567,14 @@ function getSecondaryTransactionThreadActions(
reportTransaction: Transaction,
reportActions: ReportAction[],
policy: OnyxEntry<Policy>,
canUseNewDotSplits?: boolean,
): Array<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>> {
const options: Array<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>> = [];

if (isHoldActionForTransaction(parentReport, reportTransaction, reportActions)) {
options.push(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD);
}

if (canUseNewDotSplits && isSplitAction(parentReport, [reportTransaction], policy)) {
if (isSplitAction(parentReport, [reportTransaction], policy)) {
options.push(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.SPLIT);
}

Expand Down
14 changes: 7 additions & 7 deletions tests/unit/ReportSecondaryActionUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('getSecondaryAction', () => {
transactionID: TRANSACTION_ID,
} as unknown as Transaction;

const result = getSecondaryReportActions(report, [transaction], {}, policy, undefined, undefined, undefined, true, true);
const result = getSecondaryReportActions(report, [transaction], {}, policy, undefined, undefined, undefined, true);
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.ADD_EXPENSE)).toBe(true);
});

Expand Down Expand Up @@ -476,7 +476,7 @@ describe('getSecondaryAction', () => {
await Onyx.merge(ONYXKEYS.SESSION, {email: EMPLOYEE_EMAIL, accountID: EMPLOYEE_ACCOUNT_ID});
await Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, personalDetails);

const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true, true);
const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true);
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE)).toBe(true);
});

Expand Down Expand Up @@ -507,7 +507,7 @@ describe('getSecondaryAction', () => {
await Onyx.merge(ONYXKEYS.SESSION, {email: EMPLOYEE_EMAIL, accountID: EMPLOYEE_ACCOUNT_ID});
await Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, personalDetails);

const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true, true);
const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true);
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE)).toBe(true);
});

Expand Down Expand Up @@ -540,7 +540,7 @@ describe('getSecondaryAction', () => {
await Onyx.merge(ONYXKEYS.SESSION, {email: EMPLOYEE_EMAIL, accountID: EMPLOYEE_ACCOUNT_ID});
await Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, personalDetails);

const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true, true);
const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true);
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE)).toBe(true);
});

Expand Down Expand Up @@ -586,7 +586,7 @@ describe('getSecondaryAction', () => {
await Onyx.merge(ONYXKEYS.SESSION, {email: EMPLOYEE_EMAIL, accountID: EMPLOYEE_ACCOUNT_ID});
await Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, personalDetails);

const result = getSecondaryReportActions(report, [], {}, oldPolicy, undefined, undefined, policies, true, true);
const result = getSecondaryReportActions(report, [], {}, oldPolicy, undefined, undefined, policies, true);
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE)).toBe(true);
});

Expand Down Expand Up @@ -632,7 +632,7 @@ describe('getSecondaryAction', () => {
await Onyx.merge(ONYXKEYS.SESSION, {email: APPROVER_EMAIL, accountID: APPROVER_ACCOUNT_ID});
await Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, personalDetails);

const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true, true);
const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true);
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE)).toBe(true);
});

Expand Down Expand Up @@ -680,7 +680,7 @@ describe('getSecondaryAction', () => {
await Onyx.merge(ONYXKEYS.SESSION, {email: ADMIN_EMAIL, accountID: ADMIN_ACCOUNT_ID});
await Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, personalDetails);

const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true, true);
const result = getSecondaryReportActions(report, [], {}, policy, undefined, undefined, policies, true);
expect(result.includes(CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE)).toBe(true);
});

Expand Down