From a85e54136d2f034a2a4266c60f8bfc7a7bb21e1f Mon Sep 17 00:00:00 2001 From: Eric Han Date: Sat, 9 Mar 2024 10:05:27 +0800 Subject: [PATCH] fix lint and improve comment and naming --- src/CONST.ts | 6 +-- src/libs/ReportActionsUtils.ts | 8 +-- src/pages/home/report/ReportActionItem.tsx | 62 +++++++++++----------- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 5430c7cbae74..50c76676c990 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -573,20 +573,20 @@ const CONST = { SPLIT_REPORTID: '-2', ACTIONS: { LIMIT: 50, - // OldDot Actions render getMessage from Web-Expensify/lib/Report/Action PHP files via getMarkedReimbursedMessage in ReportActionsUtils.ts + // OldDot Actions render getMessage from Web-Expensify/lib/Report/Action PHP files via getMessageOfOldDotReportAction in ReportActionsUtils.ts TYPE: { ACTIONABLEMENTIONWHISPER: 'ACTIONABLEMENTIONWHISPER', ADDCOMMENT: 'ADDCOMMENT', ACTIONABLEJOINREQUEST: 'ACTIONABLEJOINREQUEST', APPROVED: 'APPROVED', - CHANGEFIELD: 'CHANGEFIELD', // OldDot Action + CHANGEFIELD: 'CHANGEFIELD', // OldDot Action CHANGEPOLICY: 'CHANGEPOLICY', // OldDot Action CHANGETYPE: 'CHANGETYPE', // OldDot Action CHRONOSOOOLIST: 'CHRONOSOOOLIST', CLOSED: 'CLOSED', CREATED: 'CREATED', DELEGATESUBMIT: 'DELEGATESUBMIT', // OldDot Action - DELETEDACCOUNT: 'DELETEDACCOUNT', // OldDot Action + DELETEDACCOUNT: 'DELETEDACCOUNT', // OldDot Action DONATION: 'DONATION', // OldDot Action EXPORTEDTOINTEGRATION: 'EXPORTEDTOINTEGRATION', // OldDot Action EXPORTEDTOQUICKBOOKS: 'EXPORTEDTOQUICKBOOKS', // OldDot Action diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index cc2f8612d9cc..fcea05473007 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -809,10 +809,10 @@ 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. + * Helper method to format message of OldDot Actions. + * For now, we just concat all of the text elements of the message to create the full message. */ -function getMarkedReimbursedMessage(reportAction: OnyxEntry): string { +function getMessageOfOldDotReportAction(reportAction: OnyxEntry): string { return reportAction?.message?.map((element) => element.text).join('') ?? ''; } @@ -977,7 +977,7 @@ export { getFirstVisibleReportActionID, isMemberChangeAction, getMemberChangeMessageFragment, - getMarkedReimbursedMessage, + getMessageOfOldDotReportAction, getMemberChangeMessagePlainText, isReimbursementDeQueuedAction, isActionableMentionWhisper, diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index f93f4a5c69b4..efc3dc28f948 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -517,37 +517,39 @@ function ReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE) { children = ; - } else if ([ - CONST.REPORT.ACTIONS.TYPE.CHANGEFIELD, - CONST.REPORT.ACTIONS.TYPE.CHANGEPOLICY, - CONST.REPORT.ACTIONS.TYPE.CHANGETYPE, - CONST.REPORT.ACTIONS.TYPE.DELEGATESUBMIT, - CONST.REPORT.ACTIONS.TYPE.DELETEDACCOUNT, - CONST.REPORT.ACTIONS.TYPE.DONATION, - CONST.REPORT.ACTIONS.TYPE.EXPORTEDTOINTEGRATION, - CONST.REPORT.ACTIONS.TYPE.EXPORTEDTOQUICKBOOKS, - CONST.REPORT.ACTIONS.TYPE.FORWARDED, - CONST.REPORT.ACTIONS.TYPE.INTEGRATIONSMESSAGE, - CONST.REPORT.ACTIONS.TYPE.MANAGERATTACHRECEIPT, - CONST.REPORT.ACTIONS.TYPE.MANAGERDETACHRECEIPT, - CONST.REPORT.ACTIONS.TYPE.MARKEDREIMBURSED, - CONST.REPORT.ACTIONS.TYPE.MARKREIMBURSEDFROMINTEGRATION, - CONST.REPORT.ACTIONS.TYPE.OUTDATEDBANKACCOUNT, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTACHBOUNCE, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTACHCANCELLED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTACCOUNTCHANGED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTDELAYED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTREQUESTED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTSETUP, - CONST.REPORT.ACTIONS.TYPE.SELECTEDFORRANDOMAUDIT, - CONST.REPORT.ACTIONS.TYPE.SHARE, - CONST.REPORT.ACTIONS.TYPE.STRIPEPAID, - CONST.REPORT.ACTIONS.TYPE.TAKECONTROL, - CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, - CONST.REPORT.ACTIONS.TYPE.UNSHARE - ].find(oldDotActionName => oldDotActionName === action.actionName)) { + } else if ( + [ + CONST.REPORT.ACTIONS.TYPE.CHANGEFIELD, + CONST.REPORT.ACTIONS.TYPE.CHANGEPOLICY, + CONST.REPORT.ACTIONS.TYPE.CHANGETYPE, + CONST.REPORT.ACTIONS.TYPE.DELEGATESUBMIT, + CONST.REPORT.ACTIONS.TYPE.DELETEDACCOUNT, + CONST.REPORT.ACTIONS.TYPE.DONATION, + CONST.REPORT.ACTIONS.TYPE.EXPORTEDTOINTEGRATION, + CONST.REPORT.ACTIONS.TYPE.EXPORTEDTOQUICKBOOKS, + CONST.REPORT.ACTIONS.TYPE.FORWARDED, + CONST.REPORT.ACTIONS.TYPE.INTEGRATIONSMESSAGE, + CONST.REPORT.ACTIONS.TYPE.MANAGERATTACHRECEIPT, + CONST.REPORT.ACTIONS.TYPE.MANAGERDETACHRECEIPT, + CONST.REPORT.ACTIONS.TYPE.MARKEDREIMBURSED, + CONST.REPORT.ACTIONS.TYPE.MARKREIMBURSEDFROMINTEGRATION, + CONST.REPORT.ACTIONS.TYPE.OUTDATEDBANKACCOUNT, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTACHBOUNCE, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTACHCANCELLED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTACCOUNTCHANGED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTDELAYED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTREQUESTED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTSETUP, + CONST.REPORT.ACTIONS.TYPE.SELECTEDFORRANDOMAUDIT, + CONST.REPORT.ACTIONS.TYPE.SHARE, + CONST.REPORT.ACTIONS.TYPE.STRIPEPAID, + CONST.REPORT.ACTIONS.TYPE.TAKECONTROL, + CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, + CONST.REPORT.ACTIONS.TYPE.UNSHARE, + ].find((oldDotActionName) => oldDotActionName === action.actionName) + ) { // This handles all historical actions from OldDot that we just want to display the message text - children = ; + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {