Skip to content

Commit

Permalink
chore: featureToggleService use optionallyDisableFeature instead of d…
Browse files Browse the repository at this point in the history
…uplicating logic (#9073)
  • Loading branch information
daveleek authored Jan 9, 2025
1 parent b0434c9 commit 0dbecd7
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions src/lib/features/feature-toggle/feature-toggle-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,28 +983,14 @@ class FeatureToggleService {

await this.featureStrategiesStore.delete(id);

const featureStrategies =
await this.featureStrategiesStore.getStrategiesForFeatureEnv(
projectId,
featureName,
environment,
);

const hasOnlyDisabledStrategies = featureStrategies.every(
(strategy) => strategy.disabled,
// Disable the feature in the environment if it only has disabled strategies
await this.optionallyDisableFeature(
featureName,
environment,
projectId,
auditUser,
);

if (hasOnlyDisabledStrategies) {
// Disable the feature in the environment if it only has disabled strategies
await this.unprotectedUpdateEnabled(
projectId,
featureName,
environment,
false,
auditUser,
);
}

const preData = this.featureStrategyToPublic(existingStrategy);

await this.eventService.storeEvent(
Expand Down

0 comments on commit 0dbecd7

Please sign in to comment.