diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js index 161dc540fca3..74f55d9b91b6 100644 --- a/src/libs/ReportActionsUtils.js +++ b/src/libs/ReportActionsUtils.js @@ -580,6 +580,14 @@ function isMessageDeleted(reportAction) { return lodashGet(reportAction, ['message', 0, 'isDeletedParentAction'], false); } +/** + * @param {*} reportAction + * @returns {Boolean} + */ +function isSplitBillAction(reportAction) { + return lodashGet(reportAction, 'originalMessage.type', '') === CONST.IOU.REPORT_ACTION_TYPE.SPLIT; +} + export { getSortedReportActions, getLastVisibleAction, @@ -614,4 +622,5 @@ export { isWhisperAction, isPendingRemove, getReportAction, + isSplitBillAction, }; diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 79e49efb6a03..440cc46d6230 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -119,8 +119,15 @@ export default [ icon: Expensicons.ChatBubble, successTextTranslateKey: '', successIcon: null, - shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => - type === CONTEXT_MENU_TYPES.REPORT_ACTION && reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && !ReportUtils.isThreadFirstChat(reportAction, reportID), + shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID) => { + if (type !== CONTEXT_MENU_TYPES.REPORT_ACTION) { + return false; + } + const isCommentAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && !ReportUtils.isThreadFirstChat(reportAction, reportID); + const isReportPreviewAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW; + const isIOUAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && !ReportActionUtils.isSplitBillAction(reportAction); + return isCommentAction || isReportPreviewAction || isIOUAction; + }, onPress: (closePopover, {reportAction, reportID}) => { if (closePopover) { hideContextMenu(false, () => {