Skip to content

Commit

Permalink
Merge pull request #41051 from Expensify/yuwen-dismissed
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisl authored May 2, 2024
2 parents 12042db + f7bbab4 commit c5a1f96
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ const CONST = {
CREATED: 'CREATED',
DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action
DELETED_ACCOUNT: 'DELETEDACCOUNT', // OldDot Action
DISMISSED_VIOLATION: 'DISMISSEDVIOLATION',
DONATION: 'DONATION', // OldDot Action
EXPORTED_TO_CSV: 'EXPORTEDTOCSV', // OldDot Action
EXPORTED_TO_INTEGRATION: 'EXPORTEDTOINTEGRATION', // OldDot Action
Expand Down
5 changes: 5 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2921,6 +2921,11 @@ export default {
taxRateChanged: 'Tax rate was modified',
taxRequired: 'Missing tax rate',
},
violationDismissal: {
rter: {
manual: 'marked this receipt as cash.',
},
},
videoPlayer: {
play: 'Play',
pause: 'Pause',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3423,6 +3423,11 @@ export default {
taxRateChanged: 'La tasa de impuesto fue modificada',
taxRequired: 'Falta la tasa de impuesto',
},
violationDismissal: {
rter: {
manual: 'marcó el recibo como pagado en efectivo.',
},
},
videoPlayer: {
play: 'Reproducir',
pause: 'Pausar',
Expand Down
9 changes: 9 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import type {
ActionName,
ChangeLog,
IOUMessage,
OriginalMessageActionableMentionWhisper,
OriginalMessageDismissedViolation,
OriginalMessageIOU,
OriginalMessageJoinPolicyChangeLog,
OriginalMessageReimbursementDequeued,
Expand Down Expand Up @@ -1108,6 +1110,12 @@ function getReportActionMessageText(reportAction: OnyxEntry<ReportAction> | Empt
return reportAction?.message?.reduce((acc, curr) => `${acc}${curr?.text}`, '') ?? '';
}

function getDismissedViolationMessageText(originalMessage: OriginalMessageDismissedViolation['originalMessage']): string {
const reason = originalMessage.reason;
const violationName = originalMessage.violationName;
return Localize.translateLocal(`violationDismissal.${violationName}.${reason}` as TranslationPaths);
}

/**
* Check if the linked transaction is on hold
*/
Expand All @@ -1117,6 +1125,7 @@ function isLinkedTransactionHeld(reportActionID: string, reportID: string): bool

export {
extractLinksFromMessageHtml,
getDismissedViolationMessageText,
getOneTransactionThreadReportID,
getIOUReportIDFromReportActionPreview,
getLastClosedReportAction,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ function ReportActionItem({
children = <ReportActionItemBasicMessage message={action.message?.[0]?.text ?? ''} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {
children = <ReportActionItemBasicMessage message={translate('iou.unheldExpense')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.DISMISSED_VIOLATION) {
children = <ReportActionItemBasicMessage message={ReportActionsUtils.getDismissedViolationMessageText(action.originalMessage)} />;
} else {
const hasBeenFlagged =
![CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING].some((item) => item === moderationDecision) &&
Expand Down
12 changes: 11 additions & 1 deletion src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,14 @@ type OriginalMessageMoved = {
};
};

type OriginalMessageDismissedViolation = {
actionName: typeof CONST.REPORT.ACTIONS.TYPE.DISMISSED_VIOLATION;
originalMessage: {
reason: string;
violationName: string;
};
};

type OriginalMessage =
| OriginalMessageApproved
| OriginalMessageIOU
Expand All @@ -334,7 +342,8 @@ type OriginalMessage =
| OriginalMessageReimbursementDequeued
| OriginalMessageMoved
| OriginalMessageMarkedReimbursed
| OriginalMessageActionableTrackedExpenseWhisper;
| OriginalMessageActionableTrackedExpenseWhisper
| OriginalMessageDismissedViolation;

export default OriginalMessage;
export type {
Expand All @@ -360,4 +369,5 @@ export type {
DecisionName,
PaymentMethodType,
OriginalMessageActionableTrackedExpenseWhisper,
OriginalMessageDismissedViolation,
};

0 comments on commit c5a1f96

Please sign in to comment.