1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-18 00:19:49 +01:00

chore: featureToggleService use optionallyDisableFeature instead of duplicating logic (#9073)

This commit is contained in:
David Leek 2025-01-09 11:29:00 +01:00 committed by GitHub
parent b0434c9a84
commit 0dbecd78a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(