From 8711438bb0338ea1437994b4e040d19cdba08a14 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 5 Dec 2022 12:48:45 +0200 Subject: [PATCH] Fix users selection --- .../SubAccounts/SubAccount/SubUsersAdd/SubUsersAdd.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/SubAccounts/SubAccount/SubUsersAdd/SubUsersAdd.js b/src/components/SubAccounts/SubAccount/SubUsersAdd/SubUsersAdd.js index 4e94f3b3c..4171df41c 100644 --- a/src/components/SubAccounts/SubAccount/SubUsersAdd/SubUsersAdd.js +++ b/src/components/SubAccounts/SubAccount/SubUsersAdd/SubUsersAdd.js @@ -18,6 +18,7 @@ class SubUsersAdd extends PureComponent { apiSecret: PropTypes.string, })).isRequired, addMultipleAccsEnabled: PropTypes.bool.isRequired, + shouldFilterCurrentUser: PropTypes.bool.isRequired, masterAccount: PropTypes.string, authData: PropTypes.shape({ email: PropTypes.string, @@ -98,13 +99,15 @@ class SubUsersAdd extends PureComponent { authData, masterAccount, addMultipleAccsEnabled, + shouldFilterCurrentUser, } = this.props const { email: currentUserEmail } = authData const subAccountOptions = users.filter((account) => ( !account.isSubAccount - && account.email !== currentUserEmail - && account.email !== masterAccount)) + && account.email !== masterAccount + && (shouldFilterCurrentUser ? account.email !== currentUserEmail : true) + )) const takenAccountOptions = this.getTakenAccountOptions(accounts) const selectClassName = addMultipleAccsEnabled ? 'sub-account-create-select' : 'bitfinex-auth-email' @@ -131,6 +134,8 @@ class SubUsersAdd extends PureComponent { ...accountOptions, ] + console.log('+++subAccountOptionsItems', subAccountOptionsItems) + return ( /* eslint-disable-next-line react/no-array-index-key */