From 69fe7b83398c61774f638bfef764279900107b14 Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Fri, 21 Jan 2022 11:14:34 -0500 Subject: [PATCH] [bug] Always set environementUrls from client when scaffolding an account (#624) There is a use case that overrides locally set environmentUrls: an initial boot of a logged out application. We override environmentUrls with whatever the tempory settings store has, even if different urls are added before authenticating. This commit ensures we always use input environmentUrls. --- common/src/services/state.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/src/services/state.service.ts b/common/src/services/state.service.ts index 6e4da55dc8..49d5ab1164 100644 --- a/common/src/services/state.service.ts +++ b/common/src/services/state.service.ts @@ -2210,14 +2210,15 @@ export class StateService account.profile.userId, await this.defaultOnDiskLocalOptions() ); + // EnvironmentUrls are set before authenticating and should override whatever is stored from any previous session + const environmentUrls = account.settings.environmentUrls; if (storedAccount?.settings != null) { - // EnvironmentUrls are set before authenticating and should override whatever is stored from last session - storedAccount.settings.environmentUrls = account.settings.environmentUrls; account.settings = storedAccount.settings; } else if (await this.storageService.has(keys.tempAccountSettings)) { account.settings = await this.storageService.get(keys.tempAccountSettings); await this.storageService.remove(keys.tempAccountSettings); } + account.settings.environmentUrls = environmentUrls; await this.storageService.save( account.profile.userId, account,