Skip to content

Commit

Permalink
handle submitted action copy to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Dec 7, 2023
1 parent 10727a7 commit 35372e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ function isModifiedExpenseAction(reportAction: OnyxEntry<ReportAction>): boolean
return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.MODIFIEDEXPENSE;
}

function isSubmittedExpenseAction(reportAction: OnyxEntry<ReportAction>): boolean {
return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.SUBMITTED;
}

function isWhisperAction(reportAction: OnyxEntry<ReportAction>): boolean {
return (reportAction?.whisperedToAccountIDs ?? []).length > 0;
}
Expand Down Expand Up @@ -693,6 +697,7 @@ export {
isDeletedParentAction,
isMessageDeleted,
isModifiedExpenseAction,
isSubmittedExpenseAction,
isMoneyRequestAction,
isNotifiableReportAction,
isPendingRemove,
Expand Down
3 changes: 3 additions & 0 deletions src/pages/home/report/ContextMenu/ContextMenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`, '');

Check failure on line 288 in src/pages/home/report/ContextMenu/ContextMenuActions.js

View workflow job for this annotation

GitHub Actions / lint

Prefer '_.reduce' over the native function
Clipboard.setString(submittedMessage);
} else if (content) {
const parser = new ExpensiMark();
if (!Clipboard.canSetHtml()) {
Expand Down

0 comments on commit 35372e5

Please sign in to comment.