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

fix: make sure we have a user in event store #3072

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions src/lib/services/feature-toggle-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ class FeatureToggleService {
featureName: string,
environment: string,
newVariants: IVariant[],
createdBy: string,
user: User,
oldVariants?: IVariant[],
): Promise<IVariant[]> {
await variantsArraySchema.validateAsync(newVariants);
Expand All @@ -1350,7 +1350,7 @@ class FeatureToggleService {
featureName,
environment,
project: projectId,
createdBy,
createdBy: user.email || user.username,
oldVariants: theOldVariants,
newVariants: fixedVariants,
}),
Expand Down Expand Up @@ -1383,7 +1383,7 @@ class FeatureToggleService {
featureName,
environment,
newVariants,
user.username,
user,
oldVariants,
);
}
Expand All @@ -1405,7 +1405,7 @@ class FeatureToggleService {
featureName,
environments,
newVariants,
user.username,
user,
);
}

Expand All @@ -1414,7 +1414,7 @@ class FeatureToggleService {
featureName: string,
environments: string[],
newVariants: IVariant[],
createdBy: string,
user: User,
): Promise<IVariant[]> {
await variantsArraySchema.validateAsync(newVariants);
const fixedVariants = this.fixVariantWeights(newVariants);
Expand All @@ -1436,7 +1436,7 @@ class FeatureToggleService {
featureName,
environment,
project: projectId,
createdBy,
createdBy: user.email || user.username,
oldVariants: oldVariants[environment],
newVariants: fixedVariants,
}),
Expand Down
5 changes: 3 additions & 2 deletions src/test/e2e/services/feature-toggle-service-v2.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ test('If change requests are enabled, cannot change variants without going via C
});

test('If CRs are protected for any environment in the project stops bulk update of variants', async () => {
const user = { email: '[email protected]', username: 'test-user' } as User;
const project = await stores.projectStore.create({
id: 'crOnVariantsProject',
name: 'crOnVariantsProject',
Expand Down Expand Up @@ -476,7 +477,7 @@ test('If CRs are protected for any environment in the project stops bulk update
const toggle = await service.createFeatureToggle(
project.id,
{ name: 'crOnVariantToggle' },
'test-user',
user.username,
);

const variant: IVariant = {
Expand All @@ -495,7 +496,7 @@ test('If CRs are protected for any environment in the project stops bulk update
toggle.name,
[enabledEnv.name, disabledEnv.name],
[variant],
'test-user',
user,
);

const newVariants = [
Expand Down