Skip to content

Commit

Permalink
Merge branch 'master' into pluggy.ai
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-fidd authored Feb 27, 2025
2 parents 7c3147d + 1c931cf commit 0c88669
Show file tree
Hide file tree
Showing 19 changed files with 101 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ export function AccountsList({
}

return (
<View>
<View
style={{
minHeight: 'initial',
}}
>
{accounts.map(account => {
const hovered = hoveredAccount === account.id;

Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/banksync/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function BankSync() {
)}
{Object.entries(groupedAccounts).map(([syncProvider, accounts]) => {
return (
<View key={syncProvider}>
<View key={syncProvider} style={{ minHeight: 'initial' }}>
{Object.keys(groupedAccounts).length > 1 && (
<Text
style={{ fontWeight: 500, fontSize: 20, margin: '.5em 0' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function Budget() {
);
} else {
dispatch(collapseModals('category-group-menu'));
dispatch(deleteGroup(groupId));
dispatch(deleteGroup({ id: groupId }));
}
},
[categoryGroups, dispatch],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,9 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
<strong>
Link a <em>European</em> bank account
</strong>{' '}
to automatically download transactions.
</Trans>
<Trans>
GoCardless provides reliable, up-to-date information
from hundreds of banks.
to automatically download transactions. GoCardless
provides reliable, up-to-date information from
hundreds of banks.
</Trans>
</Text>
<View
Expand Down Expand Up @@ -459,11 +457,9 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) {
<strong>
Link a <em>North American</em> bank account
</strong>{' '}
to automatically download transactions.
</Trans>
<Trans>
SimpleFIN provides reliable, up-to-date information
from hundreds of banks.
to automatically download transactions. SimpleFIN
provides reliable, up-to-date information from
hundreds of banks.
</Trans>
</Text>
{isPluggyAiEnabled && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export function TransactionList({

const onManagePayees = useCallback(
id => {
navigate('/payees', { state: { selectedPayee: id } });
navigate('/payees', id && { state: { selectedPayee: id } });
},
[navigate],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,7 @@ function TransactionTableInner({
: trans.error;

const hasSplitError =
(trans.is_parent || trans.is_child) &&
(!expanded || isLastChild(transactions, index)) &&
error &&
error.type === 'SplitTransactionError';
Expand Down
1 change: 1 addition & 0 deletions packages/loot-core/src/client/data-hooks/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export function useTransactionsSearch({
resetQuery();
setIsSearching(false);
} else if (searchText) {
resetQuery();
updateQuery(previousQuery =>
queries.transactionsSearch(previousQuery, searchText, dateFormat),
);
Expand Down
14 changes: 10 additions & 4 deletions packages/loot-core/src/server/accounts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,13 +744,13 @@ type SyncResponse = {
updatedAccounts: Array<AccountEntity['id']>;
};

function handleSyncResponse(
async function handleSyncResponse(
res: {
added: Array<TransactionEntity['id']>;
updated: Array<TransactionEntity['id']>;
},
acct: db.DbAccount,
): SyncResponse {
): Promise<SyncResponse> {
const { added, updated } = res;
const newTransactions: Array<TransactionEntity['id']> = [];
const matchedTransactions: Array<TransactionEntity['id']> = [];
Expand All @@ -763,6 +763,9 @@ function handleSyncResponse(
updatedAccounts.push(acct.id);
}

const ts = new Date().getTime().toString();
await db.update('accounts', { id: acct.id, last_sync: ts });

return {
newTransactions,
matchedTransactions,
Expand Down Expand Up @@ -861,7 +864,7 @@ async function accountsBankSync({
acct.bankId,
);

const syncResponseData = handleSyncResponse(syncResponse, acct);
const syncResponseData = await handleSyncResponse(syncResponse, acct);

newTransactions.push(...syncResponseData.newTransactions);
matchedTransactions.push(...syncResponseData.matchedTransactions);
Expand Down Expand Up @@ -964,7 +967,10 @@ async function simpleFinBatchSync({
),
);
} else {
const syncResponseData = handleSyncResponse(syncResponse.res, account);
const syncResponseData = await handleSyncResponse(
syncResponse.res,
account,
);

newTransactions.push(...syncResponseData.newTransactions);
matchedTransactions.push(...syncResponseData.matchedTransactions);
Expand Down
7 changes: 6 additions & 1 deletion packages/loot-core/src/server/budget/cleanup-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ async function processCleanup(month: string): Promise<Notification> {
}

const budgetAvailable = await getSheetValue(sheetName, `to-budget`);
if (budgetAvailable <= 0) {
if (budgetAvailable < 0) {
warnings.push('Global: No funds are available to reallocate.');
}

Expand Down Expand Up @@ -351,6 +351,11 @@ async function processCleanup(month: string): Promise<Notification> {
message: 'Global: Funds not available:',
pre: warnings.join('\n\n'),
};
} else if (budgetAvailable === 0) {
return {
type: 'message',
message: 'All categories were up to date.',
};
} else {
return {
type: 'message',
Expand Down
19 changes: 19 additions & 0 deletions packages/loot-core/src/shared/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,23 @@ describe('Transactions', () => {
expect.objectContaining({ amount: 3002 }),
]);
});

test('deleting all child split transactions works', () => {
const transactions = [
makeTransaction({ amount: 2001 }),
...makeSplitTransaction(
{ id: 't1', amount: 2500, error: splitError(500) },
[{ id: 't2', amount: 2000 }],
),
makeTransaction({ amount: 3002 }),
];
const { data } = deleteTransaction(transactions, 't2');

expect(data).toEqual([
expect.objectContaining({ amount: 2001 }),
// Must delete error if no children
expect.objectContaining({ amount: 2500, error: null }),
expect.objectContaining({ amount: 3002 }),
]);
});
});
3 changes: 2 additions & 1 deletion packages/loot-core/src/shared/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,11 @@ export function deleteTransaction(
if (trans.id === id) {
return null;
} else if (trans.subtransactions?.length === 1) {
const { error, subtransactions, ...rest } = trans;
const { subtransactions, ...rest } = trans;
return {
...rest,
is_parent: false,
error: null,
} satisfies TransactionEntity;
} else {
const sub = trans.subtransactions?.filter(t => t.id !== id);
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/4458.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [matt-fidd]
---

Fix row spacing on bank sync page
6 changes: 6 additions & 0 deletions upcoming-release-notes/4461.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [alecbakholdin]
---

Fixed bug where partially erasing search string would not reset search and result in incorrect search results.
6 changes: 6 additions & 0 deletions upcoming-release-notes/4462.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [alecbakholdin]
---

Fixed bug where navigating to payees page by clicking "manage payees" with an empty payee from a transaction would result in a crash.
6 changes: 6 additions & 0 deletions upcoming-release-notes/4463.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [jfdoming]
---

Add missing space in translation for bank sync
6 changes: 6 additions & 0 deletions upcoming-release-notes/4465.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [jfdoming]
---

Fix crash when deleting child transactions from an errored split
6 changes: 6 additions & 0 deletions upcoming-release-notes/4468.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [youngcw]
---

Remove warning on cleanup templates if budget is already "clean"
6 changes: 6 additions & 0 deletions upcoming-release-notes/4469.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [matt-fidd]
---

Fix category group deletion on mobile
6 changes: 6 additions & 0 deletions upcoming-release-notes/4472.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [matt-fidd]
---

Add last bank sync tracking back in

0 comments on commit 0c88669

Please sign in to comment.