mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 10:33:02 -05:00
Fixes Issue 495 Transfer allowed from same account (#902)
This commit is contained in:
@@ -379,6 +379,7 @@ function StatusCell({
|
||||
function PayeeCell({
|
||||
id,
|
||||
payeeId,
|
||||
accountId,
|
||||
focused,
|
||||
inherited,
|
||||
payees,
|
||||
@@ -396,6 +397,9 @@ function PayeeCell({
|
||||
const isNewAutocompleteEnabled = useFeatureFlag('newAutocomplete');
|
||||
let isCreatingPayee = useRef(false);
|
||||
|
||||
// Filter out the account we're currently in as it is not a valid transfer
|
||||
accounts = accounts.filter(account => account.id !== accountId);
|
||||
|
||||
return (
|
||||
<CustomCell
|
||||
width="flex"
|
||||
@@ -786,6 +790,7 @@ export const Transaction = React.memo(function Transaction(props) {
|
||||
<PayeeCell
|
||||
id={id}
|
||||
payeeId={payeeId}
|
||||
accountId={accountId}
|
||||
focused={focusedField === 'payee'}
|
||||
inherited={inheritedFields && inheritedFields.has('payee')}
|
||||
payees={payees}
|
||||
|
||||
@@ -3,8 +3,6 @@ import { useDispatch } from 'react-redux';
|
||||
import { components as SelectComponents } from 'react-select';
|
||||
|
||||
import { createPayee } from 'loot-core/src/client/actions/queries';
|
||||
import { useCachedAccounts } from 'loot-core/src/client/data-hooks/accounts';
|
||||
import { useCachedPayees } from 'loot-core/src/client/data-hooks/payees';
|
||||
import { getActivePayees } from 'loot-core/src/client/reducers/queries';
|
||||
|
||||
import Add from '../../icons/v1/Add';
|
||||
@@ -51,6 +49,8 @@ function MenuListWithFooter(props) {
|
||||
}
|
||||
|
||||
export default function PayeeAutocomplete({
|
||||
payees,
|
||||
accounts,
|
||||
value,
|
||||
multi = false,
|
||||
showMakeTransfer = true,
|
||||
@@ -60,9 +60,6 @@ export default function PayeeAutocomplete({
|
||||
onManagePayees,
|
||||
...props
|
||||
}) {
|
||||
const payees = useCachedPayees();
|
||||
const accounts = useCachedAccounts();
|
||||
|
||||
const [focusTransferPayees, setFocusTransferPayees] = useState(
|
||||
defaultFocusTransferPayees,
|
||||
);
|
||||
|
||||
6
upcoming-release-notes/902.md
Normal file
6
upcoming-release-notes/902.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [biohzrddd]
|
||||
---
|
||||
|
||||
Remove currently viewed account from list of possible transfer accounts
|
||||
Reference in New Issue
Block a user