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

[Wave 8- ECard Transactions] Show [Reversed transaction] for deleted transactions #29310

Merged
merged 2 commits into from
Oct 12, 2023
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
5 changes: 3 additions & 2 deletions src/components/ReportActionItem/MoneyRequestAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function MoneyRequestAction({

let shouldShowPendingConversionMessage = false;
const isDeletedParentAction = ReportActionsUtils.isDeletedParentAction(action);
const isReversedTransaction = ReportActionsUtils.isReversedTransaction(action);
if (
!_.isEmpty(iouReport) &&
!_.isEmpty(reportActions) &&
Expand All @@ -128,8 +129,8 @@ function MoneyRequestAction({
shouldShowPendingConversionMessage = IOUUtils.isIOUReportPendingCurrencyConversion(iouReport);
}

return isDeletedParentAction ? (
<RenderHTML html={`<comment>${translate('parentReportAction.deletedRequest')}</comment>`} />
return isDeletedParentAction || isReversedTransaction ? (
<RenderHTML html={`<comment>${translate(isReversedTransaction ? 'parentReportAction.reversedTransaction' : 'parentReportAction.deletedRequest')}</comment>`} />
) : (
<MoneyRequestPreview
iouReportID={requestReportID}
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,7 @@ export default {
parentReportAction: {
deletedMessage: '[Deleted message]',
deletedRequest: '[Deleted request]',
reversedTransaction: '[Reversed transaction]',
deletedTask: '[Deleted task]',
hiddenMessage: '[Hidden message]',
},
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,7 @@ export default {
parentReportAction: {
deletedMessage: '[Mensaje eliminado]',
deletedRequest: '[Pedido eliminado]',
reversedTransaction: '[Transacción anulada]',
deletedTask: '[Tarea eliminado]',
hiddenMessage: '[Mensaje oculto]',
},
Expand Down
11 changes: 10 additions & 1 deletion src/libs/ReportActionsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ function isDeletedParentAction(reportAction) {
return lodashGet(reportAction, ['message', 0, 'isDeletedParentAction'], false) && lodashGet(reportAction, 'childVisibleActionCount', 0) > 0;
}

/**
* @param {Object} reportAction
* @returns {Boolean}
*/
function isReversedTransaction(reportAction) {
return lodashGet(reportAction, ['message', 0, 'isReversedTransaction'], false) && lodashGet(reportAction, 'childVisibleActionCount', 0) > 0;
grgia marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* @param {Object} reportAction
* @returns {Boolean}
Expand Down Expand Up @@ -352,7 +360,7 @@ function shouldReportActionBeVisible(reportAction, key) {
// All other actions are displayed except thread parents, deleted, or non-pending actions
const isDeleted = isDeletedAction(reportAction);
const isPending = !!reportAction.pendingAction;
return !isDeleted || isPending || isDeletedParentAction(reportAction);
return !isDeleted || isPending || isDeletedParentAction(reportAction) || isReversedTransaction(reportAction);
}

/**
Expand Down Expand Up @@ -673,6 +681,7 @@ export {
isTransactionThread,
isSentMoneyReportAction,
isDeletedParentAction,
isReversedTransaction,
isReportPreviewAction,
isModifiedExpenseAction,
getIOUReportIDFromReportActionPreview,
Expand Down
4 changes: 4 additions & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,10 @@ function hasMissingSmartscanFields(iouReportID) {
* @returns {String}
*/
function getTransactionReportName(reportAction) {
if (ReportActionsUtils.isReversedTransaction(reportAction)) {
return Localize.translateLocal('parentReportAction.reversedTransaction');
}

if (ReportActionsUtils.isDeletedParentAction(reportAction)) {
return Localize.translateLocal('parentReportAction.deletedRequest');
}
Expand Down
Loading