Skip to content

Commit

Permalink
Merge pull request Expensify#50181 from Expensify/beaman-fixSomeHtmlS…
Browse files Browse the repository at this point in the history
…htuff

Use setClipboardMessage for html to markdown conversion
  • Loading branch information
carlosmiceli authored Oct 10, 2024
2 parents 6a490ea + 9351280 commit f0be8a7
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,11 @@ const ContextMenuActions: ContextMenuAction[] = [
Clipboard.setString(displayMessage);
} else if (ReportActionsUtils.isMoneyRequestAction(reportAction)) {
const displayMessage = ReportUtils.getIOUReportActionDisplayMessage(reportAction, transaction);
Clipboard.setString(displayMessage);
if (displayMessage === Parser.htmlToText(displayMessage)) {
Clipboard.setString(displayMessage);
} else {
setClipboardMessage(displayMessage);
}
} else if (ReportActionsUtils.isCreatedTaskReportAction(reportAction)) {
const taskPreviewMessage = TaskUtils.getTaskCreatedMessage(reportAction);
Clipboard.setString(taskPreviewMessage);
Expand All @@ -444,31 +448,25 @@ const ContextMenuActions: ContextMenuAction[] = [
ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED_AND_CLOSED)
) {
const {harvesting} = ReportActionsUtils.getOriginalMessage(reportAction) ?? {};
let displayMessage = '';
if (harvesting) {
displayMessage = ReportUtils.getReportAutomaticallySubmittedMessage(reportAction);
setClipboardMessage(ReportUtils.getReportAutomaticallySubmittedMessage(reportAction));
} else {
displayMessage = ReportUtils.getIOUSubmittedMessage(reportAction);
Clipboard.setString(ReportUtils.getIOUSubmittedMessage(reportAction));
}
Clipboard.setString(displayMessage);
} else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) {
const {automaticAction} = ReportActionsUtils.getOriginalMessage(reportAction) ?? {};
let displayMessage = '';
if (automaticAction) {
displayMessage = ReportUtils.getReportAutomaticallyApprovedMessage(reportAction);
setClipboardMessage(ReportUtils.getReportAutomaticallyApprovedMessage(reportAction));
} else {
displayMessage = ReportUtils.getIOUApprovedMessage(reportAction);
Clipboard.setString(ReportUtils.getIOUApprovedMessage(reportAction));
}
Clipboard.setString(displayMessage);
} else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED)) {
const {automaticAction} = ReportActionsUtils.getOriginalMessage(reportAction) ?? {};
let displayMessage = '';
if (automaticAction) {
displayMessage = ReportUtils.getReportAutomaticallyForwardedMessage(reportAction, reportID);
setClipboardMessage(ReportUtils.getReportAutomaticallyForwardedMessage(reportAction, reportID));
} else {
displayMessage = ReportUtils.getIOUForwardedMessage(reportAction, reportID);
Clipboard.setString(ReportUtils.getIOUForwardedMessage(reportAction, reportID));
}
Clipboard.setString(displayMessage);
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
const displayMessage = ReportUtils.getRejectedReportMessage();
Clipboard.setString(displayMessage);
Expand Down

0 comments on commit f0be8a7

Please sign in to comment.