Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ const CONST = {
JOIN_ROOM: 'JOINROOM',
},
},
THREAD_DISABLED: ['CREATED'],
},
ARCHIVE_REASON: {
DEFAULT: 'default',
Expand Down
26 changes: 26 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4215,6 +4215,31 @@ function navigateToPrivateNotes(report: Report, session: Session) {
Navigation.navigate(ROUTES.PRIVATE_NOTES_LIST.getRoute(report.reportID));
}

/**
* Disable reply in thread action if:
*
* - The action is listed in the thread-disabled list
* - The action is a split bill action
* - The action is deleted and is not threaded
* - The action is a whisper action and it's neither a report preview nor IOU action
* - The action is the thread's first chat
*/
function shouldDisableThread(reportAction: ReportAction, reportID: string) {
const isSplitBillAction = ReportActionsUtils.isSplitBillAction(reportAction);
const isDeletedAction = ReportActionsUtils.isDeletedAction(reportAction);
const isReportPreviewAction = ReportActionsUtils.isReportPreviewAction(reportAction);
const isIOUAction = ReportActionsUtils.isMoneyRequestAction(reportAction);
const isWhisperAction = ReportActionsUtils.isWhisperAction(reportAction);

return (
CONST.REPORT.ACTIONS.THREAD_DISABLED.some((action: string) => action === reportAction.actionName) ||
isSplitBillAction ||
(isDeletedAction && !reportAction.childVisibleActionCount) ||
(isWhisperAction && !isReportPreviewAction && !isIOUAction) ||
isThreadFirstChat(reportAction, reportID)
);
}

export {
getReportParticipantsTitle,
isReportMessageAttachment,
Expand Down Expand Up @@ -4387,6 +4412,7 @@ export {
canEditWriteCapability,
hasSmartscanError,
shouldAutoFocusOnKeyPress,
shouldDisableThread,
};

export type {ExpenseOriginalMessage, OptionData, OptimisticChatReport};
12 changes: 1 addition & 11 deletions src/pages/home/report/ContextMenu/ContextMenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,7 @@ export default [
if (type !== CONST.CONTEXT_MENU_TYPES.REPORT_ACTION) {
return false;
}
const isCommentAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT;
const isReportPreviewAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW;
const isIOUAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && !ReportActionsUtils.isSplitBillAction(reportAction);
const isModifiedExpenseAction = ReportActionsUtils.isModifiedExpenseAction(reportAction);
const isTaskAction = ReportActionsUtils.isTaskAction(reportAction);
const isWhisperAction = ReportActionsUtils.isWhisperAction(reportAction);
return (
(!isWhisperAction || isIOUAction || isReportPreviewAction) &&
(isCommentAction || isReportPreviewAction || isIOUAction || isModifiedExpenseAction || isTaskAction) &&
!ReportUtils.isThreadFirstChat(reportAction, reportID)
);
return !ReportUtils.shouldDisableThread(reportAction, reportID);
},
onPress: (closePopover, {reportAction, reportID}) => {
if (closePopover) {
Expand Down