diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/actions.js | 8 | ||||
-rw-r--r-- | ui/app/components/pending-personal-msg.js | 2 | ||||
-rw-r--r-- | ui/app/conf-tx.js | 8 | ||||
-rw-r--r-- | ui/app/reducers/app.js | 15 |
4 files changed, 20 insertions, 13 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 12ee0367a..89a4fadfa 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -418,7 +418,7 @@ function sendTx (txData) { function completedTx (id) { return { type: actions.COMPLETED_TX, - id, + value: id, } } @@ -436,9 +436,9 @@ function cancelMsg (msgData) { } function cancelPersonalMsg (msgData) { - log.debug(`background.cancelMessage`) - background.cancelPersonalMessage(msgData.id) - return actions.completedTx(msgData.id) + const id = msgData.id + background.cancelPersonalMessage(id) + return actions.completedTx(id) } function cancelTx (txData) { diff --git a/ui/app/components/pending-personal-msg.js b/ui/app/components/pending-personal-msg.js index d48dd5ecc..4542adb28 100644 --- a/ui/app/components/pending-personal-msg.js +++ b/ui/app/components/pending-personal-msg.js @@ -34,7 +34,7 @@ PendingMsg.prototype.render = function () { // sign + cancel h('.flex-row.flex-space-around', [ h('button', { - onClick: state.cancelMessage, + onClick: state.cancelPersonalMessage, }, 'Cancel'), h('button', { onClick: state.signPersonalMessage, diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index a2e5ee94c..2df6c5384 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -111,6 +111,7 @@ ConfirmTxScreen.prototype.render = function () { signMessage: this.signMessage.bind(this, txData), signPersonalMessage: this.signPersonalMessage.bind(this, txData), cancelMessage: this.cancelMessage.bind(this, txData), + cancelPersonalMessage: this.cancelPersonalMessage.bind(this, txData), }), ]), @@ -170,7 +171,6 @@ ConfirmTxScreen.prototype.cancelTransaction = function (txData, event) { ConfirmTxScreen.prototype.signMessage = function (msgData, event) { log.info('conf-tx.js: signing message') var params = msgData.msgParams - var type = msgData.type params.metamaskId = msgData.id event.stopPropagation() this.props.dispatch(actions.signMsg(params)) @@ -190,6 +190,12 @@ ConfirmTxScreen.prototype.cancelMessage = function (msgData, event) { this.props.dispatch(actions.cancelMsg(msgData)) } +ConfirmTxScreen.prototype.cancelPersonalMessage = function (msgData, event) { + log.info('canceling personal message') + event.stopPropagation() + this.props.dispatch(actions.cancelPersonalMsg(msgData)) +} + ConfirmTxScreen.prototype.goHome = function (event) { event.stopPropagation() this.props.dispatch(actions.goHome()) diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 6d92764f1..136326301 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -9,12 +9,13 @@ function reduceApp (state, action) { log.debug('App Reducer got ' + action.type) // clone and defaults const selectedAddress = state.metamask.selectedAddress - const pendingTxs = hasPendingTxs(state) + let pendingTxs = hasPendingTxs(state) let name = 'accounts' if (selectedAddress) { name = 'accountDetail' } if (pendingTxs) { + log.debug('pending txs detected, defaulting to conf-tx view.') name = 'confTx' } @@ -310,15 +311,16 @@ function reduceApp (state, action) { }) case actions.COMPLETED_TX: - log.debug('reducing COMPLETED_TX') + log.debug('reducing COMPLETED_TX for tx ' + action.value) var { unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network } = state.metamask var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network) - .filter(tx => tx !== tx.id) - log.debug(`actions - COMPLETED_TX with ${unconfTxList.length} txs`) + .filter(tx => tx.id !== action.value ) - if (unconfTxList && unconfTxList.length > 0) { + pendingTxs = unconfTxList.length > 0 + + if (pendingTxs) { log.debug('reducer detected txs - rendering confTx view') return extend(appState, { transForward: false, @@ -583,8 +585,7 @@ function hasPendingTxs (state) { var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network) var has = unconfTxList.length > 0 - log.debug('checking if state has pending txs, concluded ' + has) - return unconfTxList.length > 0 + return has } function indexForPending (state, txId) { |