From 179d176dc1bd57bdaf3cab0896738281b60e78d7 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 30 Jun 2016 11:30:31 -0700 Subject: [PATCH 1/5] Fix broken action reference --- ui/app/actions.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/app/actions.js b/ui/app/actions.js index 0cbc3b9e6..c6b57d29d 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -47,6 +47,7 @@ var actions = { unlockInProgress: unlockInProgress, // error handling displayWarning: displayWarning, + showWarning: showWarning, // alias DISPLAY_WARNING: 'DISPLAY_WARNING', HIDE_WARNING: 'HIDE_WARNING', hideWarning: hideWarning, @@ -507,6 +508,10 @@ function hideLoadingIndication () { } } +function showWarning (text) { + return this.displayWarning(text) +} + function displayWarning (text) { return { type: actions.DISPLAY_WARNING, From f49b6ca1dc6b71a3280135a0a901311b289c26ed Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 30 Jun 2016 11:30:46 -0700 Subject: [PATCH 2/5] Replicated really strange bug with test --- app/scripts/lib/config-manager.js | 2 +- test/unit/config-manager-test.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 0af82c89c..337671c42 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -152,7 +152,7 @@ ConfigManager.prototype.getCurrentRpcAddress = function () { ConfigManager.prototype.clearWallet = function () { var data = this.getConfig() delete data.wallet - this.setData(data) + this.setConfig(data) } ConfigManager.prototype.setData = function (data) { diff --git a/test/unit/config-manager-test.js b/test/unit/config-manager-test.js index 7891c5c9e..69c462286 100644 --- a/test/unit/config-manager-test.js +++ b/test/unit/config-manager-test.js @@ -22,6 +22,7 @@ describe('config-manager', function() { describe('#setConfirmed', function() { it('should make getConfirmed return true once set', function() { + assert.equal(configManager.getConfirmed(), false) configManager.setConfirmed(true) var result = configManager.getConfirmed() assert.equal(result, true) @@ -41,6 +42,17 @@ describe('config-manager', function() { }) }) + describe('#clearWallet', function() { + it('should not erase confirmation', function() { + configManager.setConfirmed(true) + assert.equal(configManager.getConfirmed(), true) + + configManager.clearWallet() + + assert.equal(configManager.getConfirmed(), true) + }) + }) + describe('#setConfig', function() { window.localStorage = {} // Hacking localStorage support into JSDom @@ -63,8 +75,9 @@ describe('config-manager', function() { provider: { type: 'rpc', rpcTarget: 'foobar' - } + }, } + configManager.setConfirmed(true) configManager.setConfig(testConfig) var testWallet = { @@ -75,6 +88,7 @@ describe('config-manager', function() { var result = configManager.getData() assert.equal(result.wallet.name, testWallet.name, 'wallet name is set') assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget) + assert.equal(configManager.getConfirmed(), true) testConfig.provider.type = 'something else!' configManager.setConfig(testConfig) @@ -83,6 +97,7 @@ describe('config-manager', function() { assert.equal(result.wallet.name, testWallet.name, 'wallet name is set') assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget) assert.equal(result.config.provider.type, testConfig.provider.type) + assert.equal(configManager.getConfirmed(), true) }) }) From 6fef01c8a156c70e5a6034767a7ce86506f566f3 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 30 Jun 2016 11:31:27 -0700 Subject: [PATCH 3/5] Emphasizing how weird this bug is by removing all behavior from the method. --- app/scripts/lib/config-manager.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 337671c42..ca115d49e 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -149,11 +149,7 @@ ConfigManager.prototype.getCurrentRpcAddress = function () { } } -ConfigManager.prototype.clearWallet = function () { - var data = this.getConfig() - delete data.wallet - this.setConfig(data) -} +ConfigManager.prototype.clearWallet = function () {} ConfigManager.prototype.setData = function (data) { this.migrator.saveData(data) From 78f2794d39ccfff79a6562d6fdc628f375291598 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 30 Jun 2016 11:34:34 -0700 Subject: [PATCH 4/5] Remove useless and buggy clearWallet function --- app/scripts/lib/config-manager.js | 2 -- app/scripts/lib/idStore.js | 3 --- test/unit/config-manager-test.js | 11 ----------- 3 files changed, 16 deletions(-) diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index ca115d49e..caaae8a75 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -149,8 +149,6 @@ ConfigManager.prototype.getCurrentRpcAddress = function () { } } -ConfigManager.prototype.clearWallet = function () {} - ConfigManager.prototype.setData = function (data) { this.migrator.saveData(data) } diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index f705c07a7..cbc8c1e48 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -43,9 +43,6 @@ function IdentityStore (opts = {}) { IdentityStore.prototype.createNewVault = function (password, entropy, cb) { delete this._keyStore - if (this.configManager) { - this.configManager.clearWallet() - } this._createIdmgmt(password, null, entropy, (err) => { if (err) return cb(err) diff --git a/test/unit/config-manager-test.js b/test/unit/config-manager-test.js index 69c462286..8974a6bc5 100644 --- a/test/unit/config-manager-test.js +++ b/test/unit/config-manager-test.js @@ -42,17 +42,6 @@ describe('config-manager', function() { }) }) - describe('#clearWallet', function() { - it('should not erase confirmation', function() { - configManager.setConfirmed(true) - assert.equal(configManager.getConfirmed(), true) - - configManager.clearWallet() - - assert.equal(configManager.getConfirmed(), true) - }) - }) - describe('#setConfig', function() { window.localStorage = {} // Hacking localStorage support into JSDom From db3f73344b9b61c8ccb1cadb5e2113652c40df11 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 30 Jun 2016 11:42:10 -0700 Subject: [PATCH 5/5] Bump changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36e186245..769a42825 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Added network name next to network indicator - Add copy transaction hash button to completed transaction list items. - Unify wording for transaction approve/reject options on notifications and the extension. +- Fix bug where confirmation view would be shown twice. ## 2.4.5 2016-06-29