From df3633014793e76eecf68fa52bf0a9609c1cf3b6 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Wed, 15 Jul 2026 18:35:22 -0700 Subject: [PATCH] Revert "Allow negative response to be reprompted after 30 days" --- src/components/ProactiveAppReviewModalManager.tsx | 7 +------ src/hooks/useProactiveAppReview.ts | 5 +++-- .../parameters/RespondToProactiveAppReviewParams.ts | 1 - src/libs/actions/User.ts | 4 +--- tests/actions/UserTest.ts | 13 ++++++------- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/components/ProactiveAppReviewModalManager.tsx b/src/components/ProactiveAppReviewModalManager.tsx index 60ad5082d607..18d1783a1c1a 100644 --- a/src/components/ProactiveAppReviewModalManager.tsx +++ b/src/components/ProactiveAppReviewModalManager.tsx @@ -1,4 +1,3 @@ -import useActivePolicy from '@hooks/useActivePolicy'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useDelegateAccountID from '@hooks/useDelegateAccountID'; import useOnyx from '@hooks/useOnyx'; @@ -7,7 +6,6 @@ import useProactiveAppReview from '@hooks/useProactiveAppReview'; import requestStoreReview from '@libs/actions/StoreReview'; import {respondToProactiveAppReview} from '@libs/actions/User'; -import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {AppReviewResponse} from '@src/types/onyx/AppReview'; @@ -22,9 +20,6 @@ const CONCIERGE_NEGATIVE_MESSAGE = "Hi there! I'm sorry to hear you aren't fully function ProactiveAppReviewModalManager() { const {shouldShowModal, proactiveAppReview} = useProactiveAppReview(); const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); - const activePolicy = useActivePolicy(); - // Only send a policyID for real group workspaces, not personal policies. - const policyID = activePolicy && activePolicy.type !== CONST.POLICY.TYPE.PERSONAL ? activePolicy.id : undefined; const [isAnyOtherModalActive] = useOnyx(ONYXKEYS.MODAL, { selector: isModalActiveSelector, }); @@ -50,7 +45,7 @@ function ProactiveAppReviewModalManager() { } const handleResponse = (response: AppReviewResponse, message?: string) => { - respondToProactiveAppReview(response, proactiveAppReview, currentUserEmail, currentUserAccountID, delegateAccountID, policyID, message, conciergeReportID); + respondToProactiveAppReview(response, proactiveAppReview, currentUserEmail, currentUserAccountID, delegateAccountID, message, conciergeReportID); }; const handlePositive = () => { diff --git a/src/hooks/useProactiveAppReview.ts b/src/hooks/useProactiveAppReview.ts index a9b4af24becd..1eb69e565acb 100644 --- a/src/hooks/useProactiveAppReview.ts +++ b/src/hooks/useProactiveAppReview.ts @@ -31,8 +31,9 @@ function useProactiveAppReview(): UseProactiveAppReviewReturn { return false; } - // Don't show again after user gave a positive response - if (proactiveAppReview.response && proactiveAppReview.response === 'positive') { + // Don't show if user gave a definitive answer (positive/negative) + // Only allow re-prompting if they skipped + if (proactiveAppReview.response && proactiveAppReview.response !== 'skip') { return false; } diff --git a/src/libs/API/parameters/RespondToProactiveAppReviewParams.ts b/src/libs/API/parameters/RespondToProactiveAppReviewParams.ts index 085f3af04a4b..32acafe6cf71 100644 --- a/src/libs/API/parameters/RespondToProactiveAppReviewParams.ts +++ b/src/libs/API/parameters/RespondToProactiveAppReviewParams.ts @@ -2,7 +2,6 @@ type RespondToProactiveAppReviewParams = { response: 'positive' | 'negative' | 'skip'; optimisticReportActionID?: string; conciergeChatReportID?: string; - policyID?: string; }; export default RespondToProactiveAppReviewParams; diff --git a/src/libs/actions/User.ts b/src/libs/actions/User.ts index 1f6380371317..ef22c3a13b4f 100644 --- a/src/libs/actions/User.ts +++ b/src/libs/actions/User.ts @@ -1571,7 +1571,6 @@ function requestUnlockAccount(accountID: number) { type RespondToProactiveAppReviewParams = { response: 'positive' | 'negative' | 'skip'; optimisticReportActionID?: string; - policyID: string | undefined; }; /** @@ -1583,11 +1582,10 @@ function respondToProactiveAppReview( userEmail: string | undefined, userAccountID: number, delegateAccountID: number | undefined, - policyID: string | undefined, message?: string, conciergeChatReportID?: string, ) { - const params: RespondToProactiveAppReviewParams = {response, policyID}; + const params: RespondToProactiveAppReviewParams = {response}; const optimisticData: Array> = []; const successData: Array> = []; const failureData: Array> = []; diff --git a/tests/actions/UserTest.ts b/tests/actions/UserTest.ts index 0a80769f49c1..c1cd6ad045c3 100644 --- a/tests/actions/UserTest.ts +++ b/tests/actions/UserTest.ts @@ -814,24 +814,23 @@ describe('actions/User', () => { const TEST_USER_ACCOUNT_ID = 42; const TEST_USER_EMAIL = 'user@example.com'; const TEST_CONCIERGE_REPORT_ID = '999'; - const TEST_POLICY_ID = '123'; it('should call RESPOND_TO_PROACTIVE_APP_REVIEW API with the given response', async () => { - UserActions.respondToProactiveAppReview('positive', undefined, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined, TEST_POLICY_ID); + UserActions.respondToProactiveAppReview('positive', undefined, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined); await waitForBatchedUpdates(); expect(mockAPI.write).toHaveBeenCalledWith(WRITE_COMMANDS.RESPOND_TO_PROACTIVE_APP_REVIEW, expect.objectContaining({response: 'positive'}), expect.anything()); }); it('should call RESPOND_TO_PROACTIVE_APP_REVIEW API with skip response', async () => { - UserActions.respondToProactiveAppReview('skip', undefined, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined, TEST_POLICY_ID); + UserActions.respondToProactiveAppReview('skip', undefined, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined); await waitForBatchedUpdates(); expect(mockAPI.write).toHaveBeenCalledWith(WRITE_COMMANDS.RESPOND_TO_PROACTIVE_APP_REVIEW, expect.objectContaining({response: 'skip'}), expect.anything()); }); it('should include optimisticReportActionID when message and conciergeChatReportID are provided for non-skip response', async () => { - UserActions.respondToProactiveAppReview('positive', undefined, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined, TEST_POLICY_ID, 'Great app!', TEST_CONCIERGE_REPORT_ID); + UserActions.respondToProactiveAppReview('positive', undefined, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined, 'Great app!', TEST_CONCIERGE_REPORT_ID); await waitForBatchedUpdates(); expect(mockAPI.write).toHaveBeenCalledWith( @@ -845,7 +844,7 @@ describe('actions/User', () => { }); it('should NOT include optimisticReportActionID when response is skip even with message', async () => { - UserActions.respondToProactiveAppReview('skip', undefined, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined, TEST_POLICY_ID, 'Some message', TEST_CONCIERGE_REPORT_ID); + UserActions.respondToProactiveAppReview('skip', undefined, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined, 'Some message', TEST_CONCIERGE_REPORT_ID); await waitForBatchedUpdates(); expect(mockAPI.write).toHaveBeenCalledWith( @@ -860,12 +859,12 @@ describe('actions/User', () => { await Onyx.merge(ONYXKEYS.NVP_APP_REVIEW, currentReview); await waitForBatchedUpdates(); - UserActions.respondToProactiveAppReview('negative', currentReview, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined, TEST_POLICY_ID); + UserActions.respondToProactiveAppReview('negative', currentReview, TEST_USER_EMAIL, TEST_USER_ACCOUNT_ID, undefined); await waitForBatchedUpdates(); expect(mockAPI.write).toHaveBeenCalledWith( WRITE_COMMANDS.RESPOND_TO_PROACTIVE_APP_REVIEW, - expect.objectContaining({response: 'negative', policyID: TEST_POLICY_ID}), + expect.objectContaining({response: 'negative'}), expect.objectContaining({ optimisticData: expect.arrayContaining([ expect.objectContaining({