From a8fbb57bf6bc48534cda616ec0c02ed0e3c6ae7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Fri, 12 Feb 2021 16:07:52 +0000 Subject: [PATCH] fix: save only new accounts info --- lib/new-settings-loader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/new-settings-loader.js b/lib/new-settings-loader.js index 4c26db2f..8ae488f5 100644 --- a/lib/new-settings-loader.js +++ b/lib/new-settings-loader.js @@ -24,7 +24,9 @@ select $1, $2, $3, $4 where $1 not in (select type from user_config)` function saveAccounts (accountsToSave) { return loadAccounts() .then(currentAccounts => { - const newAccounts = _.assign(currentAccounts, accountsToSave) + const serviceCode = _.keys(accountsToSave)[0] + accountsToSave[serviceCode] = _.omitBy(_.isEmpty, accountsToSave[serviceCode]) + const newAccounts = _.merge(currentAccounts, accountsToSave) return db.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION]) }) }