From 6ca677c61cf7afd58a1806871b405a541b264e1c Mon Sep 17 00:00:00 2001 From: Ken Date: Tue, 2 Apr 2024 19:01:08 +0800 Subject: [PATCH] chore: remove mrf flag checks --- .../CreateFormDetailsScreen.tsx | 15 +---- .../FormResponseOptions.tsx | 57 ++++++++----------- shared/types/user.ts | 1 - src/app/models/user.server.model.ts | 1 - .../form/admin-form/admin-form.controller.ts | 8 +-- 5 files changed, 29 insertions(+), 53 deletions(-) diff --git a/frontend/src/features/workspace/components/CreateFormModal/CreateFormModalContent/CreateFormDetailsScreen.tsx b/frontend/src/features/workspace/components/CreateFormModal/CreateFormModalContent/CreateFormDetailsScreen.tsx index 0582e1cdfc..c5ecdeb4bf 100644 --- a/frontend/src/features/workspace/components/CreateFormModal/CreateFormModalContent/CreateFormDetailsScreen.tsx +++ b/frontend/src/features/workspace/components/CreateFormModal/CreateFormModalContent/CreateFormDetailsScreen.tsx @@ -20,8 +20,6 @@ import FormLabel from '~components/FormControl/FormLabel' import InlineMessage from '~components/InlineMessage' import Input from '~components/Input' -import { useUser } from '~features/user/queries' - import { WorkspaceRowsProvider } from '../../WorkspaceFormRow/WorkspaceRowsContext' import { useCreateFormWizard } from '../CreateFormWizardContext' @@ -50,18 +48,15 @@ export const CreateFormDetailsScreen = (): JSX.Element => { const titleInputValue = watch('title') const responseModeValue = watch('responseMode') - const { user } = useUser() - const showMrf = Boolean(user?.betaFlags?.mrf) - return ( <> - + {modalHeader} - + Form name @@ -87,11 +82,7 @@ export const CreateFormDetailsScreen = (): JSX.Element => { control={control} render={({ field }) => ( - + )} rules={{ required: 'Please select a form response mode' }} diff --git a/frontend/src/features/workspace/components/CreateFormModal/CreateFormModalContent/FormResponseOptions.tsx b/frontend/src/features/workspace/components/CreateFormModal/CreateFormModalContent/FormResponseOptions.tsx index 496a10084b..5ac4f717b0 100644 --- a/frontend/src/features/workspace/components/CreateFormModal/CreateFormModalContent/FormResponseOptions.tsx +++ b/frontend/src/features/workspace/components/CreateFormModal/CreateFormModalContent/FormResponseOptions.tsx @@ -10,7 +10,6 @@ import Tile from '~components/Tile' export interface FormResponseOptionsProps { onChange: (option: FormResponseMode) => void value: FormResponseMode - showMrf: boolean isSingpass: boolean } @@ -31,17 +30,13 @@ const OptionDescription = ({ listItems = [] }: { listItems: string[] }) => { export const FormResponseOptions = forwardRef< FormResponseOptionsProps, 'button' ->(({ value, onChange, showMrf, isSingpass }, ref) => { +>(({ value, onChange, isSingpass }, ref) => { return ( - Recommended - - } + badge={Recommended} isActive={value === FormResponseMode.Encrypt} onClick={() => onChange(FormResponseMode.Encrypt)} isFullWidth @@ -76,31 +71,29 @@ export const FormResponseOptions = forwardRef< ]} /> - {showMrf && ( - New} - isActive={value === FormResponseMode.Multirespondent} - onClick={() => onChange(FormResponseMode.Multirespondent)} - isFullWidth - flex={1} - isDisabled={isSingpass} - > - Multi-respondent form - - Create a workflow to collect responses from multiple respondents in - the same form submission - - - - )} + New} + isActive={value === FormResponseMode.Multirespondent} + onClick={() => onChange(FormResponseMode.Multirespondent)} + isFullWidth + flex={1} + isDisabled={isSingpass} + > + Multi-respondent form + + Create a workflow to collect responses from multiple respondents in + the same form submission + + + ) }) diff --git a/shared/types/user.ts b/shared/types/user.ts index 761c783171..6d8a0e4ad3 100644 --- a/shared/types/user.ts +++ b/shared/types/user.ts @@ -15,7 +15,6 @@ export const UserBase = z.object({ .object({ payment: z.boolean().optional(), children: z.boolean().optional(), - mrf: z.boolean().optional(), }) .optional(), flags: z diff --git a/src/app/models/user.server.model.ts b/src/app/models/user.server.model.ts index 29db752034..88d66dc231 100644 --- a/src/app/models/user.server.model.ts +++ b/src/app/models/user.server.model.ts @@ -74,7 +74,6 @@ const compileUserModel = (db: Mongoose) => { betaFlags: { payment: Boolean, children: Boolean, - mrf: Boolean, }, flags: { lastSeenFeatureUpdateVersion: Number, diff --git a/src/app/modules/form/admin-form/admin-form.controller.ts b/src/app/modules/form/admin-form/admin-form.controller.ts index 999f918008..7e21a8aa6e 100644 --- a/src/app/modules/form/admin-form/admin-form.controller.ts +++ b/src/app/modules/form/admin-form/admin-form.controller.ts @@ -5,7 +5,7 @@ import { celebrate, Joi as BaseJoi, Segments } from 'celebrate' import { AuthedSessionData } from 'express-session' import { StatusCodes } from 'http-status-codes' import JSONStream from 'JSONStream' -import { okAsync, ResultAsync } from 'neverthrow' +import { ResultAsync } from 'neverthrow' import { MAX_UPLOAD_FILE_SIZE, @@ -103,7 +103,6 @@ import { PermissionLevel } from './admin-form.types' import { mapGoGovErrors, mapRouteError, - verifyUserBetaflag, verifyValidUnicodeString, } from './admin-form.utils' @@ -1182,11 +1181,6 @@ export const createForm: ControllerHandler< return ( // Step 1: Retrieve currently logged in user. UserService.findUserById(sessionUserId) - .andThen((user) => - formParams.responseMode === FormResponseMode.Multirespondent - ? verifyUserBetaflag(user, 'mrf') - : okAsync(user), - ) // Step 2: Create form with given params and set admin to logged in user. .andThen((user) => AdminFormService.createForm(