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: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ const CONST = {
CREATED: 'CREATED',
DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action
DELETED_ACCOUNT: 'DELETEDACCOUNT', // Deprecated OldDot Action
DELETED_TRANSACTION: 'DELETEDTRANSACTION',
DISMISSED_VIOLATION: 'DISMISSEDVIOLATION',
DONATION: 'DONATION', // Deprecated OldDot Action
EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import type {
DelegatorParams,
DeleteActionParams,
DeleteConfirmationParams,
DeleteTransactionParams,
DidSplitAmountMessageParams,
EarlyDiscountSubtitleParams,
EarlyDiscountTitleParams,
Expand Down Expand Up @@ -881,6 +882,7 @@ const translations = {
canceled: 'Canceled',
posted: 'Posted',
deleteReceipt: 'Delete receipt',
deletedTransaction: ({amount, merchant}: DeleteTransactionParams) => `deleted an expense on this report, ${merchant} - ${amount}`,
Comment thread
nkdengineer marked this conversation as resolved.
pendingMatchWithCreditCard: 'Receipt pending match with card transaction',
pendingMatchWithCreditCardDescription: 'Receipt pending match with card transaction. Mark as cash to cancel.',
markAsCash: 'Mark as cash',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import type {
DelegatorParams,
DeleteActionParams,
DeleteConfirmationParams,
DeleteTransactionParams,
DidSplitAmountMessageParams,
EarlyDiscountSubtitleParams,
EarlyDiscountTitleParams,
Expand Down Expand Up @@ -880,6 +881,7 @@ const translations = {
pendingMatchWithCreditCardDescription: 'Recibo pendiente de adjuntar con la transacción de la tarjeta. Márcalo como efectivo para cancelar.',
markAsCash: 'Marcar como efectivo',
routePending: 'Ruta pendiente...',
deletedTransaction: ({amount, merchant}: DeleteTransactionParams) => `eliminó un gasto de este informe, ${merchant} - ${amount}`,
receiptIssuesFound: () => ({
one: 'Problema encontrado',
other: 'Problemas encontrados',
Expand Down
6 changes: 6 additions & 0 deletions src/languages/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ type RequestCountParams = {
pendingReceipts: number;
};

type DeleteTransactionParams = {
amount: string;
merchant: string;
};

type SettleExpensifyCardParams = {
formattedAmount: string;
};
Expand Down Expand Up @@ -725,6 +730,7 @@ export type {
ReportArchiveReasonsRemovedFromPolicyParams,
RequestAmountParams,
RequestCountParams,
DeleteTransactionParams,
RequestedAmountMessageParams,
ResolutionConstraintsParams,
RoomNameReservedErrorParams,
Expand Down
14 changes: 13 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import {autoSwitchToFocusMode} from './actions/PriorityMode';
import {hasCreditBankAccount} from './actions/ReimbursementAccount/store';
import {handleReportChanged} from './actions/Report';
import {isAnonymousUser as isAnonymousUserSession} from './actions/Session';
import {convertToDisplayString} from './CurrencyUtils';
import {convertToDisplayString, getCurrencySymbol} from './CurrencyUtils';
import DateUtils from './DateUtils';
import {hasValidDraftComment} from './DraftCommentUtils';
import {getMicroSecondOnyxErrorWithTranslationKey} from './ErrorUtils';
Expand Down Expand Up @@ -5137,6 +5137,17 @@ function getWorkspaceNameUpdatedMessage(action: ReportAction) {
return Str.htmlEncode(message);
}

function getDeletedTransactionMessage(action: ReportAction) {
const deletedTransactionOriginalMessage = getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.DELETED_TRANSACTION>) ?? {};
const amount = Math.abs(deletedTransactionOriginalMessage.amount ?? 0) / 100;
const currency = getCurrencySymbol(deletedTransactionOriginalMessage.currency ?? '');
const message = translateLocal('iou.deletedTransaction', {
amount: `${currency}${amount}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You have used wrong format for displaying amount, which caused #55837

merchant: deletedTransactionOriginalMessage.merchant ?? '',
});
return message;
}

/**
* @param iouReportID - the report ID of the IOU report the action belongs to
* @param type - IOUReportAction type. Can be oneOf(create, decline, cancel, pay, split)
Expand Down Expand Up @@ -8969,6 +8980,7 @@ export {
getIOUForwardedMessage,
getRejectedReportMessage,
getWorkspaceNameUpdatedMessage,
getDeletedTransactionMessage,
getUpgradeWorkspaceMessage,
getDowngradeWorkspaceMessage,
getReportAutomaticallySubmittedMessage,
Expand Down
3 changes: 3 additions & 0 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import {
canHoldUnholdReportAction,
changeMoneyRequestHoldStatus,
getChildReportNotificationPreference as getChildReportNotificationPreferenceReportUtils,
getDeletedTransactionMessage,
getDowngradeWorkspaceMessage,
getIOUApprovedMessage,
getIOUForwardedMessage,
Expand Down Expand Up @@ -545,6 +546,8 @@ const ContextMenuActions: ContextMenuAction[] = [
setClipboardMessage(getPolicyChangeLogChangeRoleMessage(reportAction));
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) {
setClipboardMessage(getPolicyChangeLogDeleteMemberMessage(reportAction));
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.DELETED_TRANSACTION) {
setClipboardMessage(getDeletedTransactionMessage(reportAction));
} else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) {
const {label, errorMessage} = getOriginalMessage(reportAction) ?? {label: '', errorMessage: ''};
setClipboardMessage(translateLocal('report.actions.type.integrationSyncFailed', {label, errorMessage}));
Expand Down
7 changes: 5 additions & 2 deletions src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import DisplayNames from '@components/DisplayNames';
import Hoverable from '@components/Hoverable';
import MentionReportContext from '@components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import {Eye} from '@components/Icon/Expensicons';
import InlineSystemMessage from '@components/InlineSystemMessage';
import KYCWall from '@components/KYCWall';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
Expand Down Expand Up @@ -89,6 +89,7 @@ import {
import {
canWriteInReport,
chatIncludesConcierge,
getDeletedTransactionMessage,
getDisplayNamesWithTooltips,
getIconsForParticipants,
getIOUApprovedMessage,
Expand Down Expand Up @@ -862,6 +863,8 @@ function PureReportActionItem({
children = <ReportActionItemBasicMessage message={getReportActionText(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {
children = <ReportActionItemBasicMessage message={translate('iou.unheldExpense')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.DELETED_TRANSACTION) {
children = <ReportActionItemBasicMessage message={getDeletedTransactionMessage(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.MERGED_WITH_CASH_TRANSACTION) {
children = <ReportActionItemBasicMessage message={translate('systemMessage.mergedWithCashTransaction')} />;
} else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.DISMISSED_VIOLATION)) {
Expand Down Expand Up @@ -1173,7 +1176,7 @@ function PureReportActionItem({
<View style={[styles.pl6, styles.mr3]}>
<Icon
fill={theme.icon}
src={Expensicons.Eye}
src={Eye}
small
/>
</View>
Expand Down
13 changes: 13 additions & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,18 @@ type OriginalMessageModifiedExpense = {
attendees?: string;
};

/** Model of the `deleted transaction` report action */
type OriginalMessageDeletedTransaction = {
/** The merchant of the transaction */
merchant?: string;

/** The amount of the transaction */
amount?: number;

/** The currency of the transaction */
currency?: string;
};

/** Model of `reimbursement queued` report action */
type OriginalMessageReimbursementQueued = {
/** How is the payment getting reimbursed */
Expand Down Expand Up @@ -637,6 +649,7 @@ type OriginalMessageMap = {
[CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED_VIRTUAL]: OriginalMessageCard;
[CONST.REPORT.ACTIONS.TYPE.CARD_ASSIGNED]: OriginalMessageCard;
[CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED]: OriginalMessageIntegrationSyncFailed;
[CONST.REPORT.ACTIONS.TYPE.DELETED_TRANSACTION]: OriginalMessageDeletedTransaction;
} & OldDotOriginalMessageMap & {
[T in ValueOf<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG>]: OriginalMessageChangeLog;
} & {
Expand Down