Skip to content

Commit a76e198

Browse files
authored
Merge pull request #603 from MetaMask/i566-NoPopupWhenOpen
Don't show popup when sending tx from within metamask
2 parents 32345bd + 34fd238 commit a76e198

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Current Master
44

55
- Fix bug where provider menu did not allow switching to custom network from a custom network.
6+
- Sending a transaction from within MetaMask no longer triggers a popup.
67

78
## 2.10.0 2016-08-29
89

app/scripts/lib/notifications.js

+19-11
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ module.exports = notifications
99
window.METAMASK_NOTIFIER = notifications
1010

1111
function show () {
12-
getPopup((popup) => {
13-
if (popup) {
14-
return extension.windows.update(popup.id, { focused: true })
15-
}
12+
getWindows((windows) => {
1613

14+
if (windows.length > 0) {
15+
const win = windows[0]
16+
return extension.windows.update(win.id, { focused: true })
17+
}
1718

1819
extension.windows.create({
1920
url: 'notification.html',
@@ -25,22 +26,29 @@ function show () {
2526
})
2627
}
2728

28-
function getPopup(cb) {
29-
29+
function getWindows(cb) {
3030
// Ignore in test environment
3131
if (!extension.windows) {
32-
return cb(null)
32+
return cb()
3333
}
3434

3535
extension.windows.getAll({}, (windows) => {
36-
let popup = windows.find((win) => {
37-
return win.type === 'popup'
38-
})
36+
cb(null, windows)
37+
})
38+
}
3939

40-
cb(popup)
40+
function getPopup(cb) {
41+
getWindows((windows) => {
42+
cb(getPopupIn(windows))
4143
})
4244
}
4345

46+
function getPopupIn(windows) {
47+
return windows ? windows.find((win) => {
48+
return win.type === 'popup'
49+
}) : null
50+
}
51+
4452
function closePopup() {
4553
getPopup((popup) => {
4654
if (!popup) return

ui/app/actions.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,14 @@ function signMsg (msgData) {
276276

277277
function signTx (txData) {
278278
return (dispatch) => {
279-
dispatch(actions.showLoadingIndication())
280-
281279
web3.eth.sendTransaction(txData, (err, data) => {
282280
dispatch(actions.hideLoadingIndication())
283281

284282
if (err) return dispatch(actions.displayWarning(err.message))
285283
dispatch(actions.hideWarning())
286284
dispatch(actions.goHome())
287285
})
286+
dispatch(this.showConfTxPage())
288287
}
289288
}
290289

ui/app/send.js

-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ SendTransactionScreen.prototype.onSubmit = function () {
236236
}
237237

238238
this.props.dispatch(actions.hideWarning())
239-
this.props.dispatch(actions.showLoadingIndication())
240239

241240
var txParams = {
242241
from: this.props.address,

0 commit comments

Comments
 (0)