From b3ada0d71d200c45c14f97ac5e7e4501d4a5c2fb Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Tue, 2 Jan 2024 14:16:49 +0800 Subject: [PATCH] remove all instances of the policyRooms beta --- src/CONST.ts | 1 - src/libs/Permissions.ts | 10 -- src/libs/__mocks__/Permissions.ts | 1 - src/pages/NewChatPage.js | 2 +- src/pages/NewChatSelectorPage.js | 4 - src/pages/workspace/WorkspaceNewRoomPage.js | 168 ++++++++++---------- tests/perf-test/ReportScreen.perf-test.js | 4 +- tests/perf-test/SidebarLinks.perf-test.js | 4 +- tests/perf-test/SidebarUtils.perf-test.ts | 2 +- tests/unit/SidebarFilterTest.js | 30 +--- tests/unit/SidebarOrderTest.js | 4 +- tests/unit/SidebarTest.js | 4 +- 12 files changed, 101 insertions(+), 133 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index abba27b0c33b..edcf35ab201b 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -265,7 +265,6 @@ const CONST = { CHRONOS_IN_CASH: 'chronosInCash', DEFAULT_ROOMS: 'defaultRooms', BETA_COMMENT_LINKING: 'commentLinking', - POLICY_ROOMS: 'policyRooms', VIOLATIONS: 'violations', REPORT_FIELDS: 'reportFields', }, diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 9cde613ebb5a..3d47e3ceda19 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -22,15 +22,6 @@ function canUseReportFields(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.REPORT_FIELDS) || canUseAllBetas(betas); } -/** - * We're requiring you to be added to the policy rooms beta on dev, - * since contributors have been reporting a number of false issues related to the feature being under development. - * See https://expensify.slack.com/archives/C01GTK53T8Q/p1641921996319400?thread_ts=1641598356.166900&cid=C01GTK53T8Q - */ -function canUsePolicyRooms(betas: OnyxEntry): boolean { - return !!betas?.includes(CONST.BETAS.POLICY_ROOMS) || canUseAllBetas(betas); -} - function canUseViolations(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.VIOLATIONS) || canUseAllBetas(betas); } @@ -46,7 +37,6 @@ export default { canUseChronos, canUseDefaultRooms, canUseCommentLinking, - canUsePolicyRooms, canUseLinkPreviews, canUseViolations, canUseReportFields, diff --git a/src/libs/__mocks__/Permissions.ts b/src/libs/__mocks__/Permissions.ts index 4f47c0b756b7..35b73df0464d 100644 --- a/src/libs/__mocks__/Permissions.ts +++ b/src/libs/__mocks__/Permissions.ts @@ -11,5 +11,4 @@ import Beta from '@src/types/onyx/Beta'; export default { ...jest.requireActual('../Permissions'), canUseDefaultRooms: (betas: Beta[]) => betas.includes(CONST.BETAS.DEFAULT_ROOMS), - canUsePolicyRooms: (betas: Beta[]) => betas.includes(CONST.BETAS.POLICY_ROOMS), }; diff --git a/src/pages/NewChatPage.js b/src/pages/NewChatPage.js index d7abbab6e93f..c3b3df4b3413 100755 --- a/src/pages/NewChatPage.js +++ b/src/pages/NewChatPage.js @@ -232,7 +232,7 @@ function NewChatPage({betas, isGroupChat, personalDetails, reports, translate, i // Offset is needed as KeyboardAvoidingView in nested inside of TabNavigator instead of wrapping whole screen. // This is because when wrapping whole screen the screen was freezing when changing Tabs. keyboardVerticalOffset={ - variables.contentHeaderHeight + insets.top + (Permissions.canUsePolicyRooms(betas) ? variables.tabSelectorButtonHeight + variables.tabSelectorButtonPadding : 0) + variables.contentHeaderHeight + insets.top + variables.tabSelectorButtonHeight + variables.tabSelectorButtonPadding } > 0 ? safeAreaPaddingBottomStyle : {}]}> diff --git a/src/pages/NewChatSelectorPage.js b/src/pages/NewChatSelectorPage.js index e8d392dcb477..c5e273d31c68 100755 --- a/src/pages/NewChatSelectorPage.js +++ b/src/pages/NewChatSelectorPage.js @@ -35,7 +35,6 @@ function NewChatSelectorPage(props) { testID={NewChatSelectorPage.displayName} > - {Permissions.canUsePolicyRooms(props.betas) ? ( ( @@ -55,9 +54,6 @@ function NewChatSelectorPage(props) { component={WorkspaceNewRoomPage} /> - ) : ( - - )} ); } diff --git a/src/pages/workspace/WorkspaceNewRoomPage.js b/src/pages/workspace/WorkspaceNewRoomPage.js index f0c3d3ada0c2..36487dd080ae 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.js +++ b/src/pages/workspace/WorkspaceNewRoomPage.js @@ -249,96 +249,94 @@ function WorkspaceNewRoomPage(props) { ); return ( - - - {({insets}) => - workspaceOptions.length === 0 ? ( - renderEmptyWorkspaceView() - ) : ( - + {({insets}) => + workspaceOptions.length === 0 ? ( + renderEmptyWorkspaceView() + ) : ( + + - - - - - - - - + + + + + + + + + + {isPolicyAdmin && ( + - {isPolicyAdmin && ( - - - - )} - - - - {visibilityDescription} - - {isSmallScreenWidth && } - - ) - } - - + )} + + + + {visibilityDescription} + + {isSmallScreenWidth && } + + ) + } + ); } diff --git a/tests/perf-test/ReportScreen.perf-test.js b/tests/perf-test/ReportScreen.perf-test.js index a82903762631..5eac7b98760e 100644 --- a/tests/perf-test/ReportScreen.perf-test.js +++ b/tests/perf-test/ReportScreen.perf-test.js @@ -208,7 +208,7 @@ test('[ReportScreen] should render ReportScreen with composer interactions', () [`${ONYXKEYS.COLLECTION.REPORT}${mockRoute.params.reportID}`]: report, [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${mockRoute.params.reportID}`]: reportActions, [ONYXKEYS.PERSONAL_DETAILS_LIST]: LHNTestUtils.fakePersonalDetails, - [ONYXKEYS.BETAS]: [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS], + [ONYXKEYS.BETAS]: [CONST.BETAS.DEFAULT_ROOMS], [`${ONYXKEYS.COLLECTION.POLICY}${policy.policyID}`]: policy, [`${ONYXKEYS.COLLECTION.REPORT_METADATA}${mockRoute.params.reportID}`]: { isLoadingReportActions: false, @@ -273,7 +273,7 @@ test('[ReportScreen] should press of the report item', () => { [`${ONYXKEYS.COLLECTION.REPORT}${mockRoute.params.reportID}`]: report, [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${mockRoute.params.reportID}`]: reportActions, [ONYXKEYS.PERSONAL_DETAILS_LIST]: LHNTestUtils.fakePersonalDetails, - [ONYXKEYS.BETAS]: [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS], + [ONYXKEYS.BETAS]: [CONST.BETAS.DEFAULT_ROOMS], [`${ONYXKEYS.COLLECTION.POLICY}${policy.policyID}`]: policy, [`${ONYXKEYS.COLLECTION.REPORT_METADATA}${mockRoute.params.reportID}`]: { isLoadingReportActions: false, diff --git a/tests/perf-test/SidebarLinks.perf-test.js b/tests/perf-test/SidebarLinks.perf-test.js index c6e6c024c597..1f529b08e6b3 100644 --- a/tests/perf-test/SidebarLinks.perf-test.js +++ b/tests/perf-test/SidebarLinks.perf-test.js @@ -67,7 +67,7 @@ test('[SidebarLinks] should render Sidebar with 500 reports stored', () => { Onyx.multiSet({ [ONYXKEYS.NVP_PRIORITY_MODE]: CONST.PRIORITY_MODE.DEFAULT, [ONYXKEYS.PERSONAL_DETAILS_LIST]: LHNTestUtils.fakePersonalDetails, - [ONYXKEYS.BETAS]: [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS], + [ONYXKEYS.BETAS]: [CONST.BETAS.DEFAULT_ROOMS], [ONYXKEYS.NVP_PRIORITY_MODE]: CONST.PRIORITY_MODE.GSD, [ONYXKEYS.IS_LOADING_REPORT_DATA]: false, ...mockedResponseMap, @@ -111,7 +111,7 @@ test('[SidebarLinks] should scroll and click some of the items', () => { Onyx.multiSet({ [ONYXKEYS.NVP_PRIORITY_MODE]: CONST.PRIORITY_MODE.DEFAULT, [ONYXKEYS.PERSONAL_DETAILS_LIST]: LHNTestUtils.fakePersonalDetails, - [ONYXKEYS.BETAS]: [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS], + [ONYXKEYS.BETAS]: [CONST.BETAS.DEFAULT_ROOMS], [ONYXKEYS.NVP_PRIORITY_MODE]: CONST.PRIORITY_MODE.GSD, [ONYXKEYS.IS_LOADING_REPORT_DATA]: false, ...mockedResponseMap, diff --git a/tests/perf-test/SidebarUtils.perf-test.ts b/tests/perf-test/SidebarUtils.perf-test.ts index 05143848f8b9..8be98ee54a66 100644 --- a/tests/perf-test/SidebarUtils.perf-test.ts +++ b/tests/perf-test/SidebarUtils.perf-test.ts @@ -63,7 +63,7 @@ test('[SidebarUtils] getOptionData on 5k reports', async () => { test('[SidebarUtils] getOrderedReportIDs on 5k reports', async () => { const currentReportId = '1'; const allReports = getMockedReports(); - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; const policies = createCollection( (item) => `${ONYXKEYS.COLLECTION.POLICY}${item.id}`, diff --git a/tests/unit/SidebarFilterTest.js b/tests/unit/SidebarFilterTest.js index dd2985ea34a8..088e5a1af4d0 100644 --- a/tests/unit/SidebarFilterTest.js +++ b/tests/unit/SidebarFilterTest.js @@ -154,20 +154,6 @@ describe('Sidebar', () => { const optionRows = screen.queryAllByAccessibilityHint(hintText); expect(optionRows).toHaveLength(1); }) - - // When the user is added to the policy rooms beta and the sidebar re-renders - .then(() => - Onyx.multiSet({ - [ONYXKEYS.BETAS]: [CONST.BETAS.POLICY_ROOMS], - }), - ) - - // Then the report is still rendered in the LHN - .then(() => { - const hintText = Localize.translateLocal('accessibilityHints.navigatesToChat'); - const optionRows = screen.queryAllByAccessibilityHint(hintText); - expect(optionRows).toHaveLength(1); - }) ); }); @@ -286,7 +272,7 @@ describe('Sidebar', () => { }; // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; // Given there are 6 boolean variables tested in the filtering logic: // 1. isArchived @@ -488,7 +474,7 @@ describe('Sidebar', () => { }; LHNTestUtils.getDefaultRenderedSidebarLinks(); - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; return ( waitForBatchedUpdates() @@ -551,7 +537,7 @@ describe('Sidebar', () => { }; LHNTestUtils.getDefaultRenderedSidebarLinks(); - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; return ( waitForBatchedUpdates() @@ -609,7 +595,7 @@ describe('Sidebar', () => { }; // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; // Given there are 6 boolean variables tested in the filtering logic: // 1. isArchived @@ -700,7 +686,7 @@ describe('Sidebar', () => { }; // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; return ( waitForBatchedUpdates() @@ -751,7 +737,7 @@ describe('Sidebar', () => { }; // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; return ( waitForBatchedUpdates() @@ -800,7 +786,7 @@ describe('Sidebar', () => { }; // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; return ( waitForBatchedUpdates() @@ -845,7 +831,7 @@ describe('Sidebar', () => { }; // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; return ( waitForBatchedUpdates() diff --git a/tests/unit/SidebarOrderTest.js b/tests/unit/SidebarOrderTest.js index 44d6dd57de91..4d49cb3ad516 100644 --- a/tests/unit/SidebarOrderTest.js +++ b/tests/unit/SidebarOrderTest.js @@ -752,7 +752,7 @@ describe('Sidebar', () => { Report.addComment(report3.reportID, 'Hi, this is a comment'); // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; LHNTestUtils.getDefaultRenderedSidebarLinks('0'); return ( waitForBatchedUpdates() @@ -844,7 +844,7 @@ describe('Sidebar', () => { const report3 = LHNTestUtils.getFakeReport([5, 6], 1, true); // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; LHNTestUtils.getDefaultRenderedSidebarLinks('0'); return ( waitForBatchedUpdates() diff --git a/tests/unit/SidebarTest.js b/tests/unit/SidebarTest.js index 106b2c3b69a9..56009ee382d5 100644 --- a/tests/unit/SidebarTest.js +++ b/tests/unit/SidebarTest.js @@ -56,7 +56,7 @@ describe('Sidebar', () => { }; // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; LHNTestUtils.getDefaultRenderedSidebarLinks('0'); return ( waitForBatchedUpdates() @@ -99,7 +99,7 @@ describe('Sidebar', () => { }; // Given the user is in all betas - const betas = [CONST.BETAS.DEFAULT_ROOMS, CONST.BETAS.POLICY_ROOMS]; + const betas = [CONST.BETAS.DEFAULT_ROOMS]; LHNTestUtils.getDefaultRenderedSidebarLinks('0'); return ( waitForBatchedUpdates()