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:
parent
b0434c9a84
commit
0dbecd78a0
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user