From 19c31648ac29115256649c23483c4fd11569bf10 Mon Sep 17 00:00:00 2001 From: Dysto coder Date: Wed, 26 Nov 2025 17:03:18 +0300 Subject: [PATCH 1/3] don't show categorize whisper message when category is disabled --- src/libs/ReportActionsUtils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f5a8957065fe..f404ffd8eff0 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -884,7 +884,7 @@ function isResolvedConciergeDescriptionOptions(reportAction: OnyxEntry, key: string | number, canUserPerformWriteAction?: boolean): boolean { +function shouldReportActionBeVisible(reportAction: OnyxEntry, key: string | number, canUserPerformWriteAction?: boolean, policy?: OnyxEntry): boolean { if (!reportAction) { return false; } @@ -941,6 +941,10 @@ function shouldReportActionBeVisible(reportAction: OnyxEntry, key: return false; } + if (isConciergeCategoryOptions(reportAction) && policy && !policy.areCategoriesEnabled) { + return false; + } + // All other actions are displayed except thread parents, deleted, or non-pending actions const isDeleted = isDeletedAction(reportAction); const isPending = !!reportAction.pendingAction; From 02811c377041af55a6030564f193aeee09c898b5 Mon Sep 17 00:00:00 2001 From: Dysto coder Date: Wed, 26 Nov 2025 17:05:25 +0300 Subject: [PATCH 2/3] pass policy value to shouldReportActionBeVisible to hide categorize whisper message when category is disabled --- src/pages/home/report/ReportActionsView.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index cb823521bfcd..4c32d819db11 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -108,6 +108,7 @@ function ReportActionsView({ const reportPreviewAction = useMemo(() => getReportPreviewAction(report.chatReportID, report.reportID), [report.chatReportID, report.reportID]); const didLayout = useRef(false); const {isOffline} = useNetwork(); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, {canBeMissing: true}); const {shouldUseNarrowLayout} = useResponsiveLayout(); const isFocused = useIsFocused(); @@ -222,10 +223,10 @@ function ReportActionsView({ reportActions.filter( (reportAction) => (isOffline || isDeletedParentAction(reportAction) || reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || reportAction.errors) && - shouldReportActionBeVisible(reportAction, reportAction.reportActionID, canPerformWriteAction) && + shouldReportActionBeVisible(reportAction, reportAction.reportActionID, canPerformWriteAction, policy) && isIOUActionMatchingTransactionList(reportAction, reportTransactionIDs), ), - [reportActions, isOffline, canPerformWriteAction, reportTransactionIDs], + [reportActions, isOffline, canPerformWriteAction, reportTransactionIDs, policy], ); const newestReportAction = useMemo(() => reportActions?.at(0), [reportActions]); From c173da2634394e5233d765f48726dd6a041523d6 Mon Sep 17 00:00:00 2001 From: Dysto coder Date: Fri, 12 Dec 2025 23:17:48 +0300 Subject: [PATCH 3/3] add test for shouldReportActionBeVisible when category is disabled and when there is categorize whisper message --- tests/unit/ReportActionsUtilsTest.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit/ReportActionsUtilsTest.ts b/tests/unit/ReportActionsUtilsTest.ts index 14e476617b78..6673dceb6242 100644 --- a/tests/unit/ReportActionsUtilsTest.ts +++ b/tests/unit/ReportActionsUtilsTest.ts @@ -10,6 +10,7 @@ import * as ReportActionsUtils from '../../src/libs/ReportActionsUtils'; import {getCardIssuedMessage, getOneTransactionThreadReportID, getOriginalMessage, getSendMoneyFlowAction, isIOUActionMatchingTransactionList} from '../../src/libs/ReportActionsUtils'; import ONYXKEYS from '../../src/ONYXKEYS'; import type {Card, OriginalMessageIOU, Report, ReportAction} from '../../src/types/onyx'; +import createRandomPolicy from '../utils/collections/policies'; import createRandomReportAction from '../utils/collections/reportActions'; import {createRandomReport} from '../utils/collections/reports'; import * as LHNTestUtils from '../utils/LHNTestUtils'; @@ -1411,6 +1412,14 @@ describe('ReportActionsUtils', () => { const actual = ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID, true); expect(actual).toBe(true); }); + + it("should return false for concierge categorize suggestion whisper message when the policy's category feature is disabled", () => { + const reportAction: ReportAction = {...createRandomReportAction(123), actionName: CONST.REPORT.ACTIONS.TYPE.CONCIERGE_CATEGORY_OPTIONS}; + const categoryFeatureDisabledPolicy = {...createRandomPolicy(1234), areCategoriesEnabled: false}; + + const result = ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID, true, categoryFeatureDisabledPolicy); + expect(result).toBe(false); + }); }); describe('getPolicyChangeLogUpdateEmployee', () => {