diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-04-04 07:59:32 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-04-04 07:59:32 +0800 |
commit | bf38aa6f1d793a0e18e64164a3a735e202ca34d6 (patch) | |
tree | 871b578a3626184ebfb949ba73386528603690e5 /ui/app/conf-tx.js | |
parent | 2e9273d2ac349f410e6cbc0d67ef48b3ef68e540 (diff) | |
download | tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.gz tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.bz2 tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.lz tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.xz tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.zst tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.zip |
Fix transaction confirmations
Diffstat (limited to 'ui/app/conf-tx.js')
-rw-r--r-- | ui/app/conf-tx.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 886d98be7..fee7cd36f 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -2,7 +2,7 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect -const { withRouter, Redirect } = require('react-router-dom') +const { withRouter } = require('react-router-dom') const { compose } = require('recompose') const actions = require('./actions') const txHelper = require('../lib/tx-helper') @@ -25,6 +25,7 @@ function mapStateToProps (state) { const { unapprovedMsgCount, unapprovedPersonalMsgCount, + unapprovedTypedMessagesCount, } = metamask return { @@ -45,6 +46,7 @@ function mapStateToProps (state) { computedBalances: state.metamask.computedBalances, unapprovedMsgCount, unapprovedPersonalMsgCount, + unapprovedTypedMessagesCount, send: state.metamask.send, selectedAddressTxList: state.metamask.selectedAddressTxList, } @@ -55,6 +57,16 @@ function ConfirmTxScreen () { Component.call(this) } +ConfirmTxScreen.prototype.getUnapprovedMessagesTotal = function () { + const { + unapprovedMsgCount = 0, + unapprovedPersonalMsgCount = 0, + unapprovedTypedMessagesCount = 0, + } = this.props + + return unapprovedTypedMessagesCount + unapprovedMsgCount + unapprovedPersonalMsgCount +} + ConfirmTxScreen.prototype.componentDidMount = function () { const { unapprovedTxs = {}, @@ -63,7 +75,7 @@ ConfirmTxScreen.prototype.componentDidMount = function () { } = this.props const unconfTxList = txHelper(unapprovedTxs, {}, {}, {}, network) - if (unconfTxList.length === 0 && !send.to) { + if (unconfTxList.length === 0 && !send.to && this.getUnapprovedMessagesTotal() === 0) { this.props.history.push(DEFAULT_ROUTE) } } @@ -81,7 +93,8 @@ ConfirmTxScreen.prototype.componentDidUpdate = function (prevProps) { const prevTx = selectedAddressTxList.find(({ id }) => id === prevTxData.id) || {} const unconfTxList = txHelper(unapprovedTxs, {}, {}, {}, network) - if (unconfTxList.length === 0 && (prevTx.status === 'dropped' || !send.to)) { + if (unconfTxList.length === 0 && + (prevTx.status === 'dropped' || !send.to && this.getUnapprovedMessagesTotal() === 0)) { this.props.history.push(DEFAULT_ROUTE) } } |