1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00

fix: include tags in variants event (#4711)

https://linear.app/unleash/issue/2-1396/fix-variants-event-should-include-the-respective-feature-flag-tags

This fixes an issue where the `feature-environment-variants-updated`
event would not post to a tagged Slack channel, since it would not take
into consideration the feature flag tags.
This commit is contained in:
Nuno Góis 2023-09-14 12:16:40 +01:00 committed by GitHub
parent 57c2f3865d
commit 31216d1ffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -1959,6 +1959,8 @@ class FeatureToggleService {
).variants ||
[];
const tags = await this.tagStore.getAllTagsForFeature(featureName);
await this.eventStore.store(
new EnvironmentVariantEvent({
featureName,
@ -1967,6 +1969,7 @@ class FeatureToggleService {
createdBy: user,
oldVariants: theOldVariants,
newVariants: fixedVariants,
tags,
}),
);
await this.featureEnvironmentStore.setVariantsToFeatureEnvironments(
@ -2032,6 +2035,9 @@ class FeatureToggleService {
});
oldVariants[env] = featureEnv.variants || [];
}
const tags = await this.tagStore.getAllTagsForFeature(featureName);
await this.eventStore.batchStore(
environments.map(
(environment) =>
@ -2042,6 +2048,7 @@ class FeatureToggleService {
createdBy: user,
oldVariants: oldVariants[environment],
newVariants: fixedVariants,
tags,
}),
),
);

View File

@ -431,10 +431,11 @@ export class EnvironmentVariantEvent extends BaseEvent {
environment: string;
project: string;
createdBy: string | IUser;
tags: ITag[];
newVariants: IVariant[];
oldVariants: IVariant[];
}) {
super(FEATURE_ENVIRONMENT_VARIANTS_UPDATED, p.createdBy);
super(FEATURE_ENVIRONMENT_VARIANTS_UPDATED, p.createdBy, p.tags);
this.featureName = p.featureName;
this.environment = p.environment;
this.project = p.project;