From 3fe1bb0edf94680e3d21fb0176f6466a83a63f79 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 14 Nov 2021 20:56:17 +0100 Subject: [PATCH] fix(identity): remove default for syncSource To make the create method more consistent with the guidelines, this commit removes the default value from the `syncSource` parameter. An Identity will be created as sync source, when the associated account is created using an external provider. Signed-off-by: David Mehren --- src/identity/identity.entity.ts | 2 +- src/identity/identity.service.spec.ts | 6 +++++- src/identity/identity.service.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/identity/identity.entity.ts b/src/identity/identity.entity.ts index 512070d3b..73d0964ee 100644 --- a/src/identity/identity.entity.ts +++ b/src/identity/identity.entity.ts @@ -100,7 +100,7 @@ export class Identity { public static create( user: User, providerType: ProviderType, - syncSource = false, + syncSource: boolean, ): Omit { const newIdentity = new Identity(); newIdentity.user = user; diff --git a/src/identity/identity.service.spec.ts b/src/identity/identity.service.spec.ts index 654a0bea3..c7c44ac41 100644 --- a/src/identity/identity.service.spec.ts +++ b/src/identity/identity.service.spec.ts @@ -95,7 +95,11 @@ describe('IdentityService', () => { describe('loginWithLocalIdentity', () => { it('works', async () => { - const identity = Identity.create(user, ProviderType.LOCAL) as Identity; + const identity = Identity.create( + user, + ProviderType.LOCAL, + false, + ) as Identity; identity.passwordHash = await hashPassword(password); user.identities = Promise.resolve([identity]); await expect( diff --git a/src/identity/identity.service.ts b/src/identity/identity.service.ts index 3dc1eb45b..22e573b27 100644 --- a/src/identity/identity.service.ts +++ b/src/identity/identity.service.ts @@ -36,7 +36,7 @@ export class IdentityService { * @return {Identity} the new local identity */ async createLocalIdentity(user: User, password: string): Promise { - const identity = Identity.create(user, ProviderType.LOCAL); + const identity = Identity.create(user, ProviderType.LOCAL, false); identity.passwordHash = await hashPassword(password); return await this.identityRepository.save(identity); }