diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 5ee8ef0c7a19..cca62803a24f 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -1110,6 +1110,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,
@@ -1155,4 +1165,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..5e6763f310ee 100755
--- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
+++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
@@ -20,6 +20,13 @@ const propTypes = {
/** Target node which is the target of ContentMenu */
anchor: PropTypes.node,
+
+ /** Flag to check if the chat participant is Chronos */
+ isChronosReport: PropTypes.bool,
+
+ /** Whether the provided report is an archived room */
+ isArchivedRoom: PropTypes.bool,
+
...genericReportActionContextMenuPropTypes,
...withLocalizePropTypes,
...windowDimensionsPropTypes,
@@ -28,6 +35,8 @@ const propTypes = {
const defaultProps = {
type: CONTEXT_MENU_TYPES.REPORT_ACTION,
anchor: null,
+ isChronosReport: false,
+ isArchivedRoom: false,
...GenericReportActionContextMenuDefaultProps,
};
class BaseReportActionContextMenu extends React.Component {
@@ -37,7 +46,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 32f184044d80..49e1a2f9749a 100644
--- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
+++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
@@ -3,6 +3,7 @@ import {
Dimensions,
} from 'react-native';
import _ from 'underscore';
+import PropTypes from 'prop-types';
import * as Report from '../../../../libs/actions/Report';
import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize';
import PopoverWithMeasuredContent from '../../../../components/PopoverWithMeasuredContent';
@@ -10,9 +11,20 @@ import BaseReportActionContextMenu from './BaseReportActionContextMenu';
import ConfirmModal from '../../../../components/ConfirmModal';
const propTypes = {
+ /** Flag to check if the chat participant is Chronos */
+ isChronosReport: PropTypes.bool,
+
+ /** Whether the provided report is an archived room */
+ isArchivedRoom: PropTypes.bool,
+
...withLocalizePropTypes,
};
+const defaultProps = {
+ isChronosReport: false,
+ isArchivedRoom: false,
+};
+
class PopoverReportActionContextMenu extends React.Component {
constructor(props) {
super(props);
@@ -222,6 +234,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}
/>
);
@@ -295,6 +308,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}
/>
@@ -316,5 +330,6 @@ class PopoverReportActionContextMenu extends React.Component {
}
PopoverReportActionContextMenu.propTypes = propTypes;
+PopoverReportActionContextMenu.defaultProps = defaultProps;
export default withLocalize(PopoverReportActionContextMenu);
diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js
index ad22a89c4145..2335864f916f 100644
--- a/src/pages/home/report/ReportActionCompose.js
+++ b/src/pages/home/report/ReportActionCompose.js
@@ -435,8 +435,8 @@ class ReportActionCompose extends React.Component {
this.submitForm();
}
- // Trigger the edit box for last sent message if ArrowUp is pressed and the comment is empty
- if (e.key === 'ArrowUp' && this.textInput.selectionStart === 0 && this.state.isCommentEmpty) {
+ // Trigger the edit box for last sent message if ArrowUp is pressed and the comment is empty and Chronos is not in the participants
+ if (e.key === 'ArrowUp' && this.textInput.selectionStart === 0 && this.state.isCommentEmpty && !ReportUtils.chatIncludesChronos(this.props.report)) {
e.preventDefault();
const reportActionKey = _.find(
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index e5241b6afc61..99998184df59 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -219,6 +219,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 {
>
)}