From 35372e5e105b14e3aaf8471e8355b9c0d2a5ceef Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 7 Dec 2023 23:31:17 +0800 Subject: [PATCH] handle submitted action copy to clipboard --- src/libs/ReportActionsUtils.ts | 5 +++++ src/pages/home/report/ContextMenu/ContextMenuActions.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 6dc735ebd8b7..a017cdc0b0ae 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -92,6 +92,10 @@ function isModifiedExpenseAction(reportAction: OnyxEntry): boolean return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE; } +function isSubmittedExpenseAction(reportAction: OnyxEntry): boolean { + return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.SUBMITTED; +} + function isWhisperAction(reportAction: OnyxEntry): boolean { return (reportAction?.whisperedToAccountIDs ?? []).length > 0; } @@ -693,6 +697,7 @@ export { isDeletedParentAction, isMessageDeleted, isModifiedExpenseAction, + isSubmittedExpenseAction, isMoneyRequestAction, isNotifiableReportAction, isPendingRemove, diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 4f35926c5957..e642f062d974 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -284,6 +284,9 @@ export default [ } else if (ReportActionsUtils.isChannelLogMemberAction(reportAction)) { const logMessage = ReportUtils.getChannelLogMemberMessage(reportAction); Clipboard.setString(logMessage); + } else if (ReportActionsUtils.isSubmittedExpenseAction(reportAction)) { + const submittedMessage = reportAction.message.reduce((acc, curr) => `${acc}${curr.text}`, ''); + Clipboard.setString(submittedMessage); } else if (content) { const parser = new ExpensiMark(); if (!Clipboard.canSetHtml()) {