Skip to content

Commit

Permalink
Merge pull request Expensify#33730 from Expensify/beaman-showMarkedRe…
Browse files Browse the repository at this point in the history
…imbursedActions

Show "marked reimbursed" report actions in NewDot
  • Loading branch information
dangrous authored Jan 3, 2024
2 parents 3fa11a1 + 5f7a5e6 commit 3826e5d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ const CONST = {
CLOSED: 'CLOSED',
CREATED: 'CREATED',
IOU: 'IOU',
MARKEDREIMBURSED: 'MARKEDREIMBURSED',
MODIFIEDEXPENSE: 'MODIFIEDEXPENSE',
MOVED: 'MOVED',
REIMBURSEMENTQUEUED: 'REIMBURSEMENTQUEUED',
Expand Down
9 changes: 9 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,14 @@ 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.
*/
function getMarkedReimbursedMessage(reportAction: OnyxEntry<ReportAction>): string {
return reportAction?.message?.map((element) => element.text).join('') ?? '';
}

function getMemberChangeMessagePlainText(reportAction: OnyxEntry<ReportAction>): string {
const messageElements = getMemberChangeMessageElements(reportAction);
return messageElements.map((element) => element.content).join('');
Expand Down Expand Up @@ -834,6 +842,7 @@ export {
hasRequestFromCurrentAccount,
getFirstVisibleReportActionID,
isMemberChangeAction,
getMarkedReimbursedMessage,
getMemberChangeMessageFragment,
getMemberChangeMessagePlainText,
isReimbursementDeQueuedAction,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ function ReportActionItem(props) {
children = <ReportActionItemBasicMessage message={props.translate('iou.canceledRequest', {submitterDisplayName, amount})} />;
} else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE) {
children = <ReportActionItemBasicMessage message={ModifiedExpenseMessage.getForReportAction(props.action)} />;
} else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.MARKEDREIMBURSED) {
children = <ReportActionItemBasicMessage message={ReportActionsUtils.getMarkedReimbursedMessage(props.action)} />;
} else {
const hasBeenFlagged = !_.contains([CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING], moderationDecision);
children = (
Expand Down

0 comments on commit 3826e5d

Please sign in to comment.