Fixed a bug where it was possible to make a transfer to the same account as the one making the transfer. (#1038)

The payee autocomplete was always using cached accounts. Added a check
to see if accounts was already passed in as a parameter - only using
cached if it wasnt.
This commit is contained in:
Jack
2023-05-21 19:42:05 +02:00
committed by GitHub
parent 18e3a16299
commit ec5e98b934
3 changed files with 18 additions and 2 deletions

View File

@@ -403,6 +403,7 @@ function PayeeCell({
// Filter out the account we're currently in as it is not a valid transfer
accounts = accounts.filter(account => account.id !== accountId);
payees = payees.filter(payee => payee.transfer_acct !== accountId);
return (
<CustomCell

View File

@@ -181,10 +181,19 @@ export default function PayeeAutocomplete({
onUpdate,
onSelect,
onManagePayees,
accounts,
payees,
...props
}) {
let payees = useCachedPayees();
let accounts = useCachedAccounts();
let cachedPayees = useCachedPayees();
if (!payees) {
payees = cachedPayees;
}
let cachedAccounts = useCachedAccounts();
if (!accounts) {
accounts = cachedAccounts;
}
let [focusTransferPayees, setFocusTransferPayees] = useState(
defaultFocusTransferPayees,

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [Miodec]
---
Fixed a bug where it was possible to make a transfer to the same account as the one making the transfer.