Skip to content

Commit

Permalink
fix: Removed CR on variants flag (it's GA) (#3738)
Browse files Browse the repository at this point in the history
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 <github@nunogois.com>
  • Loading branch information
Christopher Kolstad and nunogois committed May 10, 2023
1 parent 73c9780 commit eaacb97
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 25 deletions.
Expand Up @@ -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) {
Expand Down
Expand Up @@ -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 = (
Expand Down
1 change: 0 additions & 1 deletion frontend/src/interfaces/uiConfig.ts
Expand Up @@ -41,7 +41,6 @@ export interface IFlags {
messageBanner?: boolean;
featuresExportImport?: boolean;
caseInsensitiveInOperators?: boolean;
crOnVariants?: boolean;
proPlanAutoCharge?: boolean;
notifications?: boolean;
personalAccessTokensKillSwitch?: boolean;
Expand Down
2 changes: 0 additions & 2 deletions src/lib/__snapshots__/create-config.test.ts.snap
Expand Up @@ -69,7 +69,6 @@ exports[`should create default config 1`] = `
"anonymiseEventLog": false,
"caseInsensitiveInOperators": false,
"cleanClientApi": false,
"crOnVariants": false,
"demo": false,
"embedProxy": true,
"embedProxyFrontend": true,
Expand All @@ -92,7 +91,6 @@ exports[`should create default config 1`] = `
"anonymiseEventLog": false,
"caseInsensitiveInOperators": false,
"cleanClientApi": false,
"crOnVariants": false,
"demo": false,
"embedProxy": true,
"embedProxyFrontend": true,
Expand Down
14 changes: 3 additions & 11 deletions src/lib/services/feature-toggle-service.ts
Expand Up @@ -1737,13 +1737,7 @@ class FeatureToggleService {
user: User,
oldVariants?: IVariant[],
): Promise<IVariant[]> {
if (this.flagResolver.isEnabled('crOnVariants')) {
await this.stopWhenChangeRequestsEnabled(
projectId,
environment,
user,
);
}
await this.stopWhenChangeRequestsEnabled(projectId, environment, user);
return this.saveVariantsOnEnv(
projectId,
featureName,
Expand All @@ -1761,10 +1755,8 @@ class FeatureToggleService {
newVariants: IVariant[],
user: User,
): Promise<IVariant[]> {
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,
Expand Down
4 changes: 0 additions & 4 deletions src/lib/types/experimental.ts
Expand Up @@ -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,
Expand Down

0 comments on commit eaacb97

Please sign in to comment.