From dd9e03843a558a90ef4a7444e68f69f64cc41db2 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Mon, 7 Mar 2022 07:03:27 +1000 Subject: [PATCH] Use saveAccount to scaffold new account (#245) --- src/services/state.service.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/services/state.service.ts b/src/services/state.service.ts index f72ea172..d5b8b7e8 100644 --- a/src/services/state.service.ts +++ b/src/services/state.service.ts @@ -529,12 +529,12 @@ export class StateService } protected async scaffoldNewAccountDiskStorage(account: Account): Promise { - const storedAccount = await this.getAccount( - this.reconcileOptions( - { userId: account.profile.userId }, - await this.defaultOnDiskLocalOptions() - ) + const storageOptions = this.reconcileOptions( + { userId: account.profile.userId }, + await this.defaultOnDiskLocalOptions() ); + + const storedAccount = await this.getAccount(storageOptions); if (storedAccount != null) { account.settings = storedAccount.settings; account.directorySettings = storedAccount.directorySettings; @@ -551,11 +551,7 @@ export class StateService await this.storageService.remove(keys.tempDirectoryConfigs); } - await this.storageService.save( - account.profile.userId, - account, - await this.defaultOnDiskLocalOptions() - ); + await this.saveAccount(account, storageOptions); } protected async pushAccounts(): Promise {