Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hold Expense option is displayed on expenses on a closed report #42574

Merged
merged 8 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow
const isScanning = TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction);

const isDeletedParentAction = ReportActionsUtils.isDeletedAction(parentReportAction);
const canHoldOrUnholdRequest = !isSettled && !isApproved && !isDeletedParentAction;
const canHoldOrUnholdRequest = !isSettled && !isApproved && !isDeletedParentAction && !ReportUtils.isArchivedRoom(parentReport);

// If the report supports adding transactions to it, then it also supports deleting transactions from it.
const canDeleteRequest = isActionOwner && (ReportUtils.canAddOrDeleteTransactions(moneyRequestReport) || ReportUtils.isTrackExpenseReport(report)) && !isDeletedParentAction;
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,8 @@ export default {
other: 'Unexpected error, please try again later.',
genericCreateFailureMessage: 'Unexpected error submitting this expense. Please try again later.',
genericCreateInvoiceFailureMessage: 'Unexpected error sending invoice, please try again later.',
genericHoldExpenseFailureMessage: 'Unexpected error while holding the expense. Please try again later.',
genericUnholdExpenseFailureMessage: 'Unexpected error while taking the expense off hold. Please try again later.',
receiptDeleteFailureError: 'Unexpected error deleting this receipt. Please try again later.',
// eslint-disable-next-line rulesdir/use-periods-for-error-messages
receiptFailureMessage: "The receipt didn't upload. ",
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@ export default {
invalidSplit: 'La suma de las partes debe ser igual al importe total.',
invalidSplitParticipants: 'Introduce un importe superior a cero para al menos dos participantes.',
other: 'Error inesperado, por favor inténtalo más tarde.',
genericHoldExpenseFailureMessage: 'Error inesperado al bloquear el gasto, por favor inténtela de nuevo más tarde.',
genericUnholdExpenseFailureMessage: 'Error inesperado al desbloquear el gasto, por favor inténtela de nuevo más tarde.',
genericCreateFailureMessage: 'Error inesperado al enviar este gasto. Por favor, inténtalo más tarde.',
genericCreateInvoiceFailureMessage: 'Error inesperado al enviar la factura, inténtalo de nuevo más tarde.',
receiptDeleteFailureError: 'Error inesperado al borrar este recibo. Vuelve a intentarlo más tarde.',
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6679,6 +6679,7 @@ function putOnHold(transactionID: string, comment: string, reportID: string) {
comment: {
hold: null,
},
errors: ErrorUtils.getMicroSecondOnyxError('iou.genericHoldExpenseFailureMessage'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we used the wrong path for this key causing #43279

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thank you!

},
},
];
Expand Down Expand Up @@ -6740,6 +6741,7 @@ function unholdRequest(transactionID: string, reportID: string) {
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
value: {
pendingAction: null,
errors: ErrorUtils.getMicroSecondOnyxError('iou.genericUnholdExpenseFailureMessage'),
},
},
];
Expand Down
Loading