diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 9252911b4535..9535de66fd05 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1078,6 +1078,16 @@ function getChatByParticipants(newParticipantList) { }); } +/** +* Returns true if Chronos is one of the chat participants (1:1) +* @param {Object} report +* @returns {Boolean} +*/ +function chatIncludesChronos(report) { + return report.participants + && _.contains(report.participants, CONST.EMAIL.CHRONOS); +} + export { getReportParticipantsTitle, isReportMessageAttachment, @@ -1121,4 +1131,5 @@ export { getChatByParticipants, getIOUReportActionMessage, getDisplayNameForParticipant, + chatIncludesChronos, }; diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js index 7a59d3ac1935..f01ce5670bce 100755 --- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js @@ -37,7 +37,14 @@ class BaseReportActionContextMenu extends React.Component { } render() { - const shouldShowFilter = contextAction => contextAction.shouldShow(this.props.type, this.props.reportAction, this.props.isArchivedRoom, this.props.betas, this.props.anchor); + const shouldShowFilter = contextAction => contextAction.shouldShow( + this.props.type, + this.props.reportAction, + this.props.isArchivedRoom, + this.props.betas, + this.props.anchor, + this.props.isChronosReport, + ); return this.props.isVisible && ( diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 66a16a1ed036..2a6ca59c4fa6 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -163,8 +163,8 @@ export default [ { textTranslateKey: 'reportActionContextMenu.editComment', icon: Expensicons.Pencil, - shouldShow: (type, reportAction, isArchivedRoom) => ( - type === CONTEXT_MENU_TYPES.REPORT_ACTION && ReportUtils.canEditReportAction(reportAction) && !isArchivedRoom + shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport) => ( + type === CONTEXT_MENU_TYPES.REPORT_ACTION && ReportUtils.canEditReportAction(reportAction) && !isArchivedRoom && !isChronosReport ), onPress: (closePopover, {reportID, reportAction, draftMessage}) => { const editAction = () => Report.saveReportActionDraft( @@ -187,8 +187,8 @@ export default [ { textTranslateKey: 'reportActionContextMenu.deleteComment', icon: Expensicons.Trashcan, - shouldShow: (type, reportAction, isArchivedRoom) => type === CONTEXT_MENU_TYPES.REPORT_ACTION - && ReportUtils.canDeleteReportAction(reportAction) && !isArchivedRoom, + shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport) => type === CONTEXT_MENU_TYPES.REPORT_ACTION + && ReportUtils.canDeleteReportAction(reportAction) && !isArchivedRoom && !isChronosReport, onPress: (closePopover, {reportID, reportAction}) => { if (closePopover) { // Hide popover, then call showDeleteConfirmModal diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index d28e7db1ea9c..62c5aceeb4e6 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -224,6 +224,7 @@ class PopoverReportActionContextMenu extends React.Component { reportID={this.state.reportID} reportAction={this.state.reportAction} isArchivedRoom={this.props.isArchivedRoom} + isChronosReport={this.props.isChronosReport} anchor={this.contextMenuTargetNode} /> ); @@ -297,6 +298,7 @@ class PopoverReportActionContextMenu extends React.Component { reportAction={this.state.reportAction} draftMessage={this.state.reportActionDraftMessage} isArchivedRoom={this.props.isArchivedRoom} + isChronosReport={this.props.isChronosReport} anchor={this.contextMenuTargetNode} /> diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 6836540c6422..011adfd753d5 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -223,6 +223,7 @@ class ReportActionItem extends Component { && !this.props.draftMessage } draftMessage={this.props.draftMessage} + isChronosReport={ReportUtils.chatIncludesChronos(this.props.report)} /> )} diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index 722dbb840b7f..49e62dd10784 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -375,6 +375,7 @@ class ReportActionsView extends React.Component { )}