diff options
author | kumavis <kumavis@users.noreply.github.com> | 2019-03-29 13:48:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-29 13:48:15 +0800 |
commit | 133ed80aeeeea4e2b0e9f1acb532f5d66f2575ca (patch) | |
tree | d9b30fd03951f8ced1c04487af03a224cf5a00b7 | |
parent | 86752630c87a3b34a49259e415e00088a4ebe036 (diff) | |
parent | 0961449ca05e48c82961b58cce2b6ad5ca32714e (diff) | |
download | tangerine-wallet-browser-133ed80aeeeea4e2b0e9f1acb532f5d66f2575ca.tar tangerine-wallet-browser-133ed80aeeeea4e2b0e9f1acb532f5d66f2575ca.tar.gz tangerine-wallet-browser-133ed80aeeeea4e2b0e9f1acb532f5d66f2575ca.tar.bz2 tangerine-wallet-browser-133ed80aeeeea4e2b0e9f1acb532f5d66f2575ca.tar.lz tangerine-wallet-browser-133ed80aeeeea4e2b0e9f1acb532f5d66f2575ca.tar.xz tangerine-wallet-browser-133ed80aeeeea4e2b0e9f1acb532f5d66f2575ca.tar.zst tangerine-wallet-browser-133ed80aeeeea4e2b0e9f1acb532f5d66f2575ca.zip |
Merge pull request #6372 from MetaMask/addAddressIfNew
prevent add duplicates when address is not new
-rw-r--r-- | ui/app/components/app/send/send-footer/send-footer.container.js | 3 | ||||
-rw-r--r-- | ui/app/components/app/send/send-footer/send-footer.utils.js | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/ui/app/components/app/send/send-footer/send-footer.container.js b/ui/app/components/app/send/send-footer/send-footer.container.js index 502159a81..ea3fd7ee4 100644 --- a/ui/app/components/app/send/send-footer/send-footer.container.js +++ b/ui/app/components/app/send/send-footer/send-footer.container.js @@ -96,9 +96,10 @@ function mapDispatchToProps (dispatch) { return dispatch(updateTransaction(editingTx)) }, + addToAddressBookIfNew: (newAddress, toAccounts, nickname = '') => { const hexPrefixedAddress = ethUtil.addHexPrefix(newAddress) - if (addressIsNew(toAccounts)) { + if (addressIsNew(toAccounts, hexPrefixedAddress)) { // TODO: nickname, i.e. addToAddressBook(recipient, nickname) dispatch(addToAddressBook(hexPrefixedAddress, nickname)) } diff --git a/ui/app/components/app/send/send-footer/send-footer.utils.js b/ui/app/components/app/send/send-footer/send-footer.utils.js index f82ff1e9b..abb2ebc77 100644 --- a/ui/app/components/app/send/send-footer/send-footer.utils.js +++ b/ui/app/components/app/send/send-footer/send-footer.utils.js @@ -74,7 +74,9 @@ function constructUpdatedTx ({ } function addressIsNew (toAccounts, newAddress) { - return !toAccounts.find(({ address }) => newAddress === address) + const newAddressNormalized = newAddress.toLowerCase() + const foundMatching = toAccounts.some(({ address }) => address === newAddressNormalized) + return !foundMatching } module.exports = { |