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]) }) }