Skip to content

Commit

Permalink
fix lint and improve comment and naming
Browse files Browse the repository at this point in the history
  • Loading branch information
eh2077 committed Mar 9, 2024
1 parent 9329f83 commit a85e541
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,10 @@ function getMemberChangeMessageFragment(reportAction: OnyxEntry<ReportAction>):
}

/**
* 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<ReportAction>): string {
function getMessageOfOldDotReportAction(reportAction: OnyxEntry<ReportAction>): string {
return reportAction?.message?.map((element) => element.text).join('') ?? '';
}

Expand Down Expand Up @@ -977,7 +977,7 @@ export {
getFirstVisibleReportActionID,
isMemberChangeAction,
getMemberChangeMessageFragment,
getMarkedReimbursedMessage,
getMessageOfOldDotReportAction,
getMemberChangeMessagePlainText,
isReimbursementDeQueuedAction,
isActionableMentionWhisper,
Expand Down
62 changes: 32 additions & 30 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -517,37 +517,39 @@ 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.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 = <ReportActionItemBasicMessage message={ReportActionsUtils.getMarkedReimbursedMessage(action)} />;
children = <ReportActionItemBasicMessage message={ReportActionsUtils.getMessageOfOldDotReportAction(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
children = <ReportActionItemBasicMessage message={translate('iou.heldRequest', {comment: action.message?.[1].text ?? ''})} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {
Expand Down

0 comments on commit a85e541

Please sign in to comment.