mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-02-18 08:52:42 +00:00
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 <git@herrmehren.de>
This commit is contained in:
parent
178513a3a0
commit
3fe1bb0edf
3 changed files with 7 additions and 3 deletions
|
@ -100,7 +100,7 @@ export class Identity {
|
||||||
public static create(
|
public static create(
|
||||||
user: User,
|
user: User,
|
||||||
providerType: ProviderType,
|
providerType: ProviderType,
|
||||||
syncSource = false,
|
syncSource: boolean,
|
||||||
): Omit<Identity, 'id' | 'createdAt' | 'updatedAt'> {
|
): Omit<Identity, 'id' | 'createdAt' | 'updatedAt'> {
|
||||||
const newIdentity = new Identity();
|
const newIdentity = new Identity();
|
||||||
newIdentity.user = user;
|
newIdentity.user = user;
|
||||||
|
|
|
@ -95,7 +95,11 @@ describe('IdentityService', () => {
|
||||||
|
|
||||||
describe('loginWithLocalIdentity', () => {
|
describe('loginWithLocalIdentity', () => {
|
||||||
it('works', async () => {
|
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);
|
identity.passwordHash = await hashPassword(password);
|
||||||
user.identities = Promise.resolve([identity]);
|
user.identities = Promise.resolve([identity]);
|
||||||
await expect(
|
await expect(
|
||||||
|
|
|
@ -36,7 +36,7 @@ export class IdentityService {
|
||||||
* @return {Identity} the new local identity
|
* @return {Identity} the new local identity
|
||||||
*/
|
*/
|
||||||
async createLocalIdentity(user: User, password: string): Promise<Identity> {
|
async createLocalIdentity(user: User, password: string): Promise<Identity> {
|
||||||
const identity = Identity.create(user, ProviderType.LOCAL);
|
const identity = Identity.create(user, ProviderType.LOCAL, false);
|
||||||
identity.passwordHash = await hashPassword(password);
|
identity.passwordHash = await hashPassword(password);
|
||||||
return await this.identityRepository.save(identity);
|
return await this.identityRepository.save(identity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue