mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-03 01:18:43 +02: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);
|
await this.featureStrategiesStore.delete(id);
|
||||||
|
|
||||||
const featureStrategies =
|
// Disable the feature in the environment if it only has disabled strategies
|
||||||
await this.featureStrategiesStore.getStrategiesForFeatureEnv(
|
await this.optionallyDisableFeature(
|
||||||
projectId,
|
featureName,
|
||||||
featureName,
|
environment,
|
||||||
environment,
|
projectId,
|
||||||
);
|
auditUser,
|
||||||
|
|
||||||
const hasOnlyDisabledStrategies = featureStrategies.every(
|
|
||||||
(strategy) => strategy.disabled,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
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);
|
const preData = this.featureStrategyToPublic(existingStrategy);
|
||||||
|
|
||||||
await this.eventService.storeEvent(
|
await this.eventService.storeEvent(
|
||||||
|
Loading…
Reference in New Issue
Block a user