From d4b8396b1e97ba183e9cddf400c0394c502a8e05 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Sun, 29 Sep 2024 20:46:15 -0600 Subject: [PATCH] prettify --- src/libs/OptionsListUtils.ts | 5 ++++- src/libs/ReportUtils.ts | 16 +++++++++++++--- .../report/ContextMenu/ContextMenuActions.tsx | 5 ++++- src/pages/home/report/ReportActionItem.tsx | 5 ++++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 2fc51b0bc5f0..88068b73d441 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -660,7 +660,10 @@ function getLastMessageTextForReport(report: OnyxEntry, lastActorDetails lastMessageTextFromReport = ReportUtils.formatReportLastMessageText(TaskUtils.getTaskReportActionMessage(lastReportAction).text); } else if (ReportActionUtils.isCreatedTaskReportAction(lastReportAction)) { lastMessageTextFromReport = TaskUtils.getTaskCreatedMessage(lastReportAction); - } else if (ReportActionUtils.isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) || ReportActionUtils.isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED)) { + } else if ( + ReportActionUtils.isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) || + ReportActionUtils.isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED) + ) { const wasSubmittedViaHarvesting = ReportActionUtils.getOriginalMessage(lastReportAction)?.harvesting ?? false; if (wasSubmittedViaHarvesting) { lastMessageTextFromReport = ReportUtils.getReportAutomaticallySubmittedMessage(lastReportAction); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 9ee89d6499ae..5867d8f87555 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3781,7 +3781,10 @@ function getReportName( } const parentReportActionMessage = ReportActionsUtils.getReportActionMessage(parentReportAction); - if (ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) || ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED)) { + if ( + ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) || + ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED) + ) { return getIOUSubmittedMessage(parentReportAction); } if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) { @@ -4510,7 +4513,12 @@ function buildOptimisticExpenseReport( } function getFormattedAmount(reportAction: ReportAction) { - if (!ReportActionsUtils.isSubmittedAction(reportAction) && !ReportActionsUtils.isForwardedAction(reportAction) && !ReportActionsUtils.isApprovedAction(reportAction) && !ReportActionsUtils.isSubmittedAndClosedAction(reportAction)) { + if ( + !ReportActionsUtils.isSubmittedAction(reportAction) && + !ReportActionsUtils.isForwardedAction(reportAction) && + !ReportActionsUtils.isApprovedAction(reportAction) && + !ReportActionsUtils.isSubmittedAndClosedAction(reportAction) + ) { return ''; } const originalMessage = ReportActionsUtils.getOriginalMessage(reportAction); @@ -4518,7 +4526,9 @@ function getFormattedAmount(reportAction: ReportAction) { return formattedAmount; } -function getReportAutomaticallySubmittedMessage(reportAction: ReportAction | ReportAction) { +function getReportAutomaticallySubmittedMessage( + reportAction: ReportAction | ReportAction, +) { return Localize.translateLocal('iou.automaticallySubmittedAmount', {formattedAmount: getFormattedAmount(reportAction)}); } diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 57ecb9f9c331..57dc8041b434 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -439,7 +439,10 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(CONST.ACTIONABLE_TRACK_EXPENSE_WHISPER_MESSAGE); } else if (ReportActionsUtils.isRenamedAction(reportAction)) { setClipboardMessage(ReportActionsUtils.getRenamedAction(reportAction)); - } else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) || ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED)) { + } else if ( + ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) || + ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED) + ) { const displayMessage = ReportUtils.getIOUSubmittedMessage(reportAction); Clipboard.setString(displayMessage); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) { diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 562e113b8e83..604bcb7d5eed 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -627,7 +627,10 @@ function ReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIED_EXPENSE) { children = ; - } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) || ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED)) { + } else if ( + ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.SUBMITTED) || + ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED) + ) { const wasSubmittedViaHarvesting = ReportActionsUtils.getOriginalMessage(action)?.harvesting ?? false; if (wasSubmittedViaHarvesting) { children = (