Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: featureToggleService use optionallyDisableFeature instead of duplicating logic #9073

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading