From eaacb979d63323121935e38f5f8e28232fbc40de Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Wed, 10 May 2023 15:46:41 +0200 Subject: [PATCH] fix: Removed CR on variants flag (it's GA) (#3738) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR removes the usage of crOnVariants flag, but keeps the behaviour, so CR are now enabled on variants. --------- Co-authored-by: Nuno Góis --- .../EnvironmentVariantsModal.tsx | 4 +--- .../FeatureEnvironmentVariants.tsx | 6 ++---- frontend/src/interfaces/uiConfig.ts | 1 - src/lib/__snapshots__/create-config.test.ts.snap | 2 -- src/lib/services/feature-toggle-service.ts | 14 +++----------- src/lib/types/experimental.ts | 4 ---- 6 files changed, 6 insertions(+), 25 deletions(-) diff --git a/frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/EnvironmentVariantsModal/EnvironmentVariantsModal.tsx b/frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/EnvironmentVariantsModal/EnvironmentVariantsModal.tsx index 83058c7c43..8d80af481b 100644 --- a/frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/EnvironmentVariantsModal/EnvironmentVariantsModal.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/EnvironmentVariantsModal/EnvironmentVariantsModal.tsx @@ -269,9 +269,7 @@ export const EnvironmentVariantsModal = ({ ? 'Add to existing change request' : 'Add change to draft'; - const isChangeRequest = - isChangeRequestConfigured(environment?.name || '') && - uiConfig.flags.crOnVariants; + const isChangeRequest = isChangeRequestConfigured(environment?.name || ''); const stickiness = useMemo(() => { if (!loading) { diff --git a/frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/FeatureEnvironmentVariants.tsx b/frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/FeatureEnvironmentVariants.tsx index 0b9f2e653a..b242f8f43b 100644 --- a/frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/FeatureEnvironmentVariants.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants/FeatureEnvironmentVariants.tsx @@ -69,11 +69,9 @@ export const FeatureEnvironmentVariants = () => { () => feature?.environments?.map(environment => ({ ...environment, - crEnabled: - uiConfig.flags.crOnVariants && - isChangeRequestConfigured(environment.name), + crEnabled: isChangeRequestConfigured(environment.name), })) || [], - [feature.environments, uiConfig.flags.crOnVariants] + [feature.environments] ); const createPatch = ( diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index d911b28cec..1dd8c05e66 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -41,7 +41,6 @@ export interface IFlags { messageBanner?: boolean; featuresExportImport?: boolean; caseInsensitiveInOperators?: boolean; - crOnVariants?: boolean; proPlanAutoCharge?: boolean; notifications?: boolean; personalAccessTokensKillSwitch?: boolean; diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index f465c04746..8b88ce1d77 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -69,7 +69,6 @@ exports[`should create default config 1`] = ` "anonymiseEventLog": false, "caseInsensitiveInOperators": false, "cleanClientApi": false, - "crOnVariants": false, "demo": false, "embedProxy": true, "embedProxyFrontend": true, @@ -92,7 +91,6 @@ exports[`should create default config 1`] = ` "anonymiseEventLog": false, "caseInsensitiveInOperators": false, "cleanClientApi": false, - "crOnVariants": false, "demo": false, "embedProxy": true, "embedProxyFrontend": true, diff --git a/src/lib/services/feature-toggle-service.ts b/src/lib/services/feature-toggle-service.ts index 6a58cd553c..8f9200dc97 100644 --- a/src/lib/services/feature-toggle-service.ts +++ b/src/lib/services/feature-toggle-service.ts @@ -1737,13 +1737,7 @@ class FeatureToggleService { user: User, oldVariants?: IVariant[], ): Promise { - if (this.flagResolver.isEnabled('crOnVariants')) { - await this.stopWhenChangeRequestsEnabled( - projectId, - environment, - user, - ); - } + await this.stopWhenChangeRequestsEnabled(projectId, environment, user); return this.saveVariantsOnEnv( projectId, featureName, @@ -1761,10 +1755,8 @@ class FeatureToggleService { newVariants: IVariant[], user: User, ): Promise { - if (this.flagResolver.isEnabled('crOnVariants')) { - for (const env of environments) { - await this.stopWhenChangeRequestsEnabled(projectId, env); - } + for (const env of environments) { + await this.stopWhenChangeRequestsEnabled(projectId, env); } return this.setVariantsOnEnvs( projectId, diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 34579918c7..57507532d0 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -33,10 +33,6 @@ const flags = { process.env.UNLEASH_EXPERIMENTAL_CASE_INSENSITIVE_IN_OPERATORS, false, ), - crOnVariants: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_CR_ON_VARIANTS, - false, - ), strictSchemaValidation: parseEnvVarBoolean( process.env.UNLEASH_STRICT_SCHEMA_VALIDTION, false,