From bc2b8a18b3709ad1fc9fde4652d96f8761275e11 Mon Sep 17 00:00:00 2001 From: Krishna Chaitanya Date: Tue, 2 Dec 2025 19:09:54 +0530 Subject: [PATCH 1/5] disable threading for manager mctest messages --- src/libs/ReportUtils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 5ce0be6833cd..c57a9858ebde 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -10676,9 +10676,13 @@ function shouldDisableThread(reportAction: OnyxInputOrEntry, repor const isIOUAction = isMoneyRequestAction(reportAction); const isWhisperActionLocal = isWhisperAction(reportAction) || isActionableTrackExpense(reportAction); const isActionDisabled = CONST.REPORT.ACTIONS.THREAD_DISABLED.some((action: string) => action === reportAction?.actionName); + const isManagerMcTestOwner = + reportAction?.actorAccountID === CONST.ACCOUNT_ID.MANAGER_MCTEST || + reportAction?.actor === CONST.EMAIL.MANAGER_MCTEST; return ( isActionDisabled || + isManagerMcTestOwner || isSplitBillAction || (isDeletedActionLocal && !reportAction?.childVisibleActionCount) || (isReportArchived && !reportAction?.childVisibleActionCount) || From 9ec45e999c2865a293c7be141b161abc50d9ee9f Mon Sep 17 00:00:00 2001 From: Krishna Chaitanya Date: Fri, 12 Dec 2025 11:34:58 +0530 Subject: [PATCH 2/5] use only accountID check --- src/libs/ReportUtils.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 33c91eccff7e..4901f3f98c61 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -10766,9 +10766,7 @@ function shouldDisableThread(reportAction: OnyxInputOrEntry, repor const isIOUAction = isMoneyRequestAction(reportAction); const isWhisperActionLocal = isWhisperAction(reportAction) || isActionableTrackExpense(reportAction); const isActionDisabled = CONST.REPORT.ACTIONS.THREAD_DISABLED.some((action: string) => action === reportAction?.actionName); - const isManagerMcTestOwner = - reportAction?.actorAccountID === CONST.ACCOUNT_ID.MANAGER_MCTEST || - reportAction?.actor === CONST.EMAIL.MANAGER_MCTEST; + const isManagerMcTestOwner = reportAction?.actorAccountID === CONST.ACCOUNT_ID.MANAGER_MCTEST; return ( isActionDisabled || From 8dd37c7009ea1cdc465b73de8daeb4c91df46192 Mon Sep 17 00:00:00 2001 From: Krishna Chaitanya Date: Fri, 12 Dec 2025 11:46:56 +0530 Subject: [PATCH 3/5] remove join thread from context menu actions --- src/libs/ReportUtils.ts | 2 +- src/pages/home/report/ContextMenu/ContextMenuActions.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 4901f3f98c61..fec859219c9e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -10759,7 +10759,7 @@ function getNonHeldAndFullAmount(iouReport: OnyxEntry, shouldExcludeNonR * - 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: OnyxInputOrEntry, reportID: string, isThreadReportParentAction: boolean, isReportArchived = false): boolean { +function shouldDisableThread(reportAction: OnyxInputOrEntry, isThreadReportParentAction: boolean, isReportArchived = false): boolean { const isSplitBillAction = isSplitBillReportAction(reportAction); const isDeletedActionLocal = isDeletedAction(reportAction); const isReportPreviewActionLocal = isReportPreviewAction(reportAction); diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index d8c5c427205c..c17ec33717e7 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -317,7 +317,7 @@ const ContextMenuActions: ContextMenuAction[] = [ if (type !== CONST.CONTEXT_MENU_TYPES.REPORT_ACTION || !reportID) { return false; } - return !shouldDisableThread(reportAction, reportID, isThreadReportParentAction, isArchivedRoom); + return !shouldDisableThread(reportAction, isThreadReportParentAction, isArchivedRoom); }, onPress: (closePopover, {reportAction, reportID}) => { const originalReportID = getOriginalReportID(reportID, reportAction); @@ -456,12 +456,14 @@ const ContextMenuActions: ContextMenuAction[] = [ const isWhisperAction = isWhisperActionReportActionsUtils(reportAction) || isActionableTrackExpense(reportAction); const isExpenseReportAction = isMoneyRequestAction(reportAction) || isReportPreviewActionReportActionsUtils(reportAction); const isTaskAction = isCreatedTaskReportAction(reportAction); + const shouldDisableJoinThread = shouldDisableThread(reportAction, isThreadReportParentAction, isArchivedRoom); return ( !subscribed && !isWhisperAction && !isTaskAction && !isExpenseReportAction && !isThreadReportParentAction && + !shouldDisableJoinThread && (shouldDisplayThreadReplies || (!isDeletedAction && !isArchivedRoom)) ); }, From 8d6b88fd2d93a31d4a478fded670eb99b179e3f9 Mon Sep 17 00:00:00 2001 From: Krishna Chaitanya Date: Fri, 12 Dec 2025 12:03:25 +0530 Subject: [PATCH 4/5] remove unused reportID parameter --- tests/unit/ReportUtilsTest.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index b1b8b70312d1..8235ddc1eef6 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -3323,7 +3323,7 @@ describe('ReportUtils', () => { it('should disable on thread-disabled actions', () => { const reportAction = buildOptimisticCreatedReportAction('email1@test.com'); - expect(shouldDisableThread(reportAction, reportID, false)).toBeTruthy(); + expect(shouldDisableThread(reportAction, false)).toBeTruthy(); }); it('should disable thread on split expense actions', () => { @@ -3335,7 +3335,7 @@ describe('ReportUtils', () => { participants: [{login: 'email1@test.com'}, {login: 'email2@test.com'}], transactionID: NumberUtils.rand64(), }) as ReportAction; - expect(shouldDisableThread(reportAction, reportID, false)).toBeTruthy(); + expect(shouldDisableThread(reportAction, false)).toBeTruthy(); }); it("should disable on a whisper action and it's neither a report preview nor IOU action", () => { @@ -3345,14 +3345,14 @@ describe('ReportUtils', () => { whisperedTo: [123456], }, } as ReportAction; - expect(shouldDisableThread(reportAction, reportID, false)).toBeTruthy(); + expect(shouldDisableThread(reportAction, false)).toBeTruthy(); }); it('should disable on thread first chat', () => { const reportAction = { childReportID: reportID, } as ReportAction; - expect(shouldDisableThread(reportAction, reportID, true)).toBeTruthy(); + expect(shouldDisableThread(reportAction, true)).toBeTruthy(); }); describe('deleted threads', () => { @@ -3371,7 +3371,7 @@ describe('ReportUtils', () => { } as ReportAction; // When it's checked to see if the thread should be disabled - const isThreadDisabled = shouldDisableThread(reportAction, reportID, false); + const isThreadDisabled = shouldDisableThread(reportAction, false); // Then the thread should be enabled expect(isThreadDisabled).toBeFalsy(); @@ -3392,7 +3392,7 @@ describe('ReportUtils', () => { } as ReportAction; // When it's checked to see if the thread should be disabled - const isThreadDisabled = shouldDisableThread(reportAction, reportID, false); + const isThreadDisabled = shouldDisableThread(reportAction, false); // Then the thread should be enabled expect(isThreadDisabled).toBeFalsy(); @@ -3412,7 +3412,7 @@ describe('ReportUtils', () => { } as ReportAction; // When it's checked to see if the thread should be disabled - const isThreadDisabled = shouldDisableThread(reportAction, reportID, false); + const isThreadDisabled = shouldDisableThread(reportAction, false); // Then the thread should be enabled expect(isThreadDisabled).toBeFalsy(); @@ -3433,7 +3433,7 @@ describe('ReportUtils', () => { } as ReportAction; // When it's checked to see if the thread should be disabled - const isThreadDisabled = shouldDisableThread(reportAction, reportID, false); + const isThreadDisabled = shouldDisableThread(reportAction, false); // Then the thread should be disabled expect(isThreadDisabled).toBeTruthy(); @@ -3459,7 +3459,7 @@ describe('ReportUtils', () => { const isReportArchived = false; // When it's checked to see if the thread should be disabled - const isThreadDisabled = shouldDisableThread(reportAction, reportID, false, isReportArchived); + const isThreadDisabled = shouldDisableThread(reportAction, false, isReportArchived); // Then the thread should be enabled expect(isThreadDisabled).toBeFalsy(); @@ -3482,7 +3482,7 @@ describe('ReportUtils', () => { const isReportArchived = false; // When it's checked to see if the thread should be disabled - const isThreadDisabled = shouldDisableThread(reportAction, reportID, false, isReportArchived); + const isThreadDisabled = shouldDisableThread(reportAction, false, isReportArchived); // Then the thread should be enabled expect(isThreadDisabled).toBeFalsy(); @@ -3505,7 +3505,7 @@ describe('ReportUtils', () => { const isReportArchived = true; // When it's checked to see if the thread should be disabled - const isThreadDisabled = shouldDisableThread(reportAction, reportID, false, isReportArchived); + const isThreadDisabled = shouldDisableThread(reportAction, false, isReportArchived); // Then the thread should be enabled expect(isThreadDisabled).toBeFalsy(); @@ -3528,7 +3528,7 @@ describe('ReportUtils', () => { const isReportArchived = true; // When it's checked to see if the thread should be disabled - const isThreadDisabled = shouldDisableThread(reportAction, reportID, false, isReportArchived); + const isThreadDisabled = shouldDisableThread(reportAction, false, isReportArchived); // Then the thread should be disabled expect(isThreadDisabled).toBeTruthy(); From 7df695b77bbcf9e776aca182222c9beed9daadea Mon Sep 17 00:00:00 2001 From: Krishna Chaitanya Date: Fri, 12 Dec 2025 20:59:13 +0530 Subject: [PATCH 5/5] add test for disabling threading for mctest --- tests/unit/ReportUtilsTest.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 8235ddc1eef6..994136752463 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -3355,6 +3355,29 @@ describe('ReportUtils', () => { expect(shouldDisableThread(reportAction, true)).toBeTruthy(); }); + it('should disable thread for messages sent by MANAGER_MCTEST', () => { + // Given a report action from MANAGER_MCTEST + const reportAction = { + actorAccountID: CONST.ACCOUNT_ID.MANAGER_MCTEST, + message: [ + { + translationKey: '', + type: 'COMMENT', + html: 'Test message from Manager McTest', + text: 'Test message from Manager McTest', + }, + ], + actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT, + } as ReportAction; + + // When it's checked to see if the thread should be disabled + const isThreadDisabled = shouldDisableThread(reportAction, false); + + // Then the thread should be disabled + // This ensures "Reply in thread" and "Join thread" context menu options won't be shown + expect(isThreadDisabled).toBeTruthy(); + }); + describe('deleted threads', () => { it('should be enabled if the report action is not-deleted and child visible action count is 1', () => { // Given a normal report action with one child visible action count