From c3b0c09836b498509b4301b4eafc72149599c323 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 28 Dec 2023 15:42:12 -0800 Subject: [PATCH 1/3] New MarkedReimbursed action --- src/CONST.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CONST.ts b/src/CONST.ts index 34720adf8a21..520ee0399b55 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -512,6 +512,7 @@ const CONST = { CLOSED: 'CLOSED', CREATED: 'CREATED', IOU: 'IOU', + MARKEDREIMBURSED: 'MARKEDREIMBURSED', MODIFIEDEXPENSE: 'MODIFIEDEXPENSE', MOVED: 'MOVED', REIMBURSEMENTQUEUED: 'REIMBURSEMENTQUEUED', From 8c2b91f9dfd3ded9caba06af5fc3183a091a39d6 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 28 Dec 2023 15:42:33 -0800 Subject: [PATCH 2/3] Show new report action in reports --- src/libs/ReportActionsUtils.ts | 9 +++++++++ src/pages/home/report/ReportActionItem.js | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 4847eee2c8c6..a64a9c9c5297 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -751,6 +751,14 @@ function getMemberChangeMessageFragment(reportAction: OnyxEntry): }; } +/** + * MARKEDREIMBURSED reportActions come from marking a report as reimbursed in OldDot. For now, we just + * concat all of the text elements of the message to create the full message. + */ +function getMarkedReimbursedMessage(reportAction: OnyxEntry): string { + return reportAction?.message?.map((element) => element.text).join('') || ''; +} + function getMemberChangeMessagePlainText(reportAction: OnyxEntry): string { const messageElements = getMemberChangeMessageElements(reportAction); return messageElements.map((element) => element.content).join(''); @@ -820,6 +828,7 @@ export { hasRequestFromCurrentAccount, getFirstVisibleReportActionID, isMemberChangeAction, + getMarkedReimbursedMessage, getMemberChangeMessageFragment, getMemberChangeMessagePlainText, isReimbursementDeQueuedAction, diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index e2a345d33a32..2ecbd9c74eef 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -422,6 +422,8 @@ function ReportActionItem(props) { children = ; } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE) { children = ; + } else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MARKEDREIMBURSED) { + children = ; } else { const hasBeenFlagged = !_.contains([CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING], moderationDecision); children = ( From 5f7a5e6b02b6c4df6765558b16fbbc87484b8f7a Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 28 Dec 2023 16:00:27 -0800 Subject: [PATCH 3/3] Prefer nullish coalescing --- src/libs/ReportActionsUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index a64a9c9c5297..b1a5e9e6f715 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -756,7 +756,7 @@ function getMemberChangeMessageFragment(reportAction: OnyxEntry): * concat all of the text elements of the message to create the full message. */ function getMarkedReimbursedMessage(reportAction: OnyxEntry): string { - return reportAction?.message?.map((element) => element.text).join('') || ''; + return reportAction?.message?.map((element) => element.text).join('') ?? ''; } function getMemberChangeMessagePlainText(reportAction: OnyxEntry): string {