Skip to content

Commit

Permalink
extract check to method isOldDotReportAction
Browse files Browse the repository at this point in the history
  • Loading branch information
eh2077 committed Mar 14, 2024
1 parent a3cbc26 commit ea29ad9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 32 deletions.
34 changes: 34 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,39 @@ function getMemberChangeMessageFragment(reportAction: OnyxEntry<ReportAction>):
};
}

function isOldDotReportAction(action: ReportAction): boolean {
return [
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.EXPORTEDTOCSV,
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,
].some((oldDotActionName) => oldDotActionName === action.actionName);
}

/**
* 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.
Expand Down Expand Up @@ -977,6 +1010,7 @@ export {
getFirstVisibleReportActionID,
isMemberChangeAction,
getMemberChangeMessageFragment,
isOldDotReportAction,
getMessageOfOldDotReportAction,
getMemberChangeMessagePlainText,
isReimbursementDeQueuedAction,
Expand Down
33 changes: 1 addition & 32 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -517,38 +517,7 @@ function ReportActionItem({
children = <ReportActionItemBasicMessage message={ReportUtils.getReimbursementDeQueuedActionMessage(action, report)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE) {
children = <ReportActionItemBasicMessage message={ModifiedExpenseMessage.getForReportAction(report.reportID, action)} />;
} 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.EXPORTEDTOCSV,
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 (ReportActionsUtils.isOldDotReportAction(action)) {
// This handles all historical actions from OldDot that we just want to display the message text
children = <ReportActionItemBasicMessage message={ReportActionsUtils.getMessageOfOldDotReportAction(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
Expand Down

0 comments on commit ea29ad9

Please sign in to comment.