A local-first personal finance app
:bug: (gocardless) fix sync when additionalInformation field is null (#2238)
Matiss Janis Aboltins363c9e4afbe4
diff --git a/packages/loot-core/src/server/accounts/sync.ts b/packages/loot-core/src/server/accounts/sync.tsindex ae04efa675..fa6d313405 100644--- a/packages/loot-core/src/server/accounts/sync.ts+++ b/packages/loot-core/src/server/accounts/sync.ts@@ -309,14 +309,15 @@ async function normalizeGoCardlessTransactions(transactions, acctId) {// that it matters whether the amount is a positive or negative zero.if (trans.amount > 0 || Object.is(Number(trans.amount), 0)) {const nameParts = [];- nameParts.push(- title(- trans.debtorName ||- trans.remittanceInformationUnstructured ||- (trans.remittanceInformationUnstructuredArray || []).join(', ') ||- trans.additionalInformation,- ),- );+ const name =+ trans.debtorName ||+ trans.remittanceInformationUnstructured ||+ (trans.remittanceInformationUnstructuredArray || []).join(', ') ||+ trans.additionalInformation;++ if (name) {+ nameParts.push(title(name));+ }if (trans.debtorAccount && trans.debtorAccount.iban) {nameParts.push('(' +@@ -329,14 +330,15 @@ async function normalizeGoCardlessTransactions(transactions, acctId) {payee_name = nameParts.join(' ');} else {const nameParts = [];- nameParts.push(- title(- trans.creditorName ||- trans.remittanceInformationUnstructured ||- (trans.remittanceInformationUnstructuredArray || []).join(', ') ||- trans.additionalInformation,- ),- );+ const name =+ trans.creditorName ||+ trans.remittanceInformationUnstructured ||+ (trans.remittanceInformationUnstructuredArray || []).join(', ') ||+ trans.additionalInformation;++ if (name) {+ nameParts.push(title(name));+ }if (trans.creditorAccount && trans.creditorAccount.iban) {nameParts.push('(' +diff --git a/upcoming-release-notes/2238.md b/upcoming-release-notes/2238.mdnew file mode 100644index 0000000000..a38296a0bc--- /dev/null+++ b/upcoming-release-notes/2238.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [MatissJanis]+---++GoCardless: fix sync not working if `additionalInformation` fallback field is null