Delete unused `UNLOCK_METAMASK` action (#8307)

This action was never triggered in practice, as MetaMask is never
unlocked from the UI. The unlock always occurs as a result of a
background state update.
feature/default_network_editable
Mark Stacey 5 years ago committed by GitHub
parent 5b64a3d75e
commit 2e67751efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      test/unit/reducers/unlock_vault_test.js
  2. 11
      test/unit/ui/app/reducers/app.spec.js
  3. 11
      test/unit/ui/app/reducers/metamask.spec.js
  4. 12
      ui/app/ducks/app/app.js
  5. 8
      ui/app/ducks/metamask/metamask.js
  6. 8
      ui/app/store/actions.js

@ -1,35 +0,0 @@
import assert from 'assert'
import * as actions from '../../../ui/app/store/actions'
import reducers from '../../../ui/app/ducks'
describe('#unlockMetamask(selectedAccount)', function () {
describe('after an error', function () {
it('clears warning', function () {
const warning = 'this is the wrong warning'
const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
},
}
const resultState = reducers(initialState, actions.unlockMetamask(account))
assert.equal(resultState.appState.warning, null, 'warning nullified')
})
})
describe('going home after an error', function () {
it('clears warning', function () {
const warning = 'this is the wrong warning'
// const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
},
}
const resultState = reducers(initialState, actions.goHome())
assert.equal(resultState.appState.warning, null, 'warning nullified')
})
})
})

@ -144,17 +144,6 @@ describe('App State', function () {
assert.equal(state.warning, null)
})
it('unlocks Metamask', function () {
const state = reduceApp(metamaskState, {
type: actions.UNLOCK_METAMASK,
})
assert.equal(state.forgottenPassword, null)
assert.deepEqual(state.detailView, {})
assert.equal(state.transForward, true)
assert.equal(state.warning, null)
})
it('locks Metamask', function () {
const state = reduceApp(metamaskState, {
type: actions.LOCK_METAMASK,

@ -9,17 +9,6 @@ describe('MetaMask Reducers', function () {
assert(initState)
})
it('unlocks MetaMask', function () {
const state = reduceMetamask({}, {
type: actions.UNLOCK_METAMASK,
value: 'test address',
})
assert.equal(state.isUnlocked, true)
assert.equal(state.isInitialized, true)
assert.equal(state.selectedAddress, 'test address')
})
it('locks MetaMask', function () {
const unlockMetaMaskState = {
isUnlocked: true,

@ -159,18 +159,6 @@ export default function reduceApp (state = {}, action) {
warning: null,
}
// unlock
case actions.UNLOCK_METAMASK:
return {
...appState,
forgottenPassword: appState.forgottenPassword ? !appState.forgottenPassword : null,
detailView: {},
transForward: true,
isLoading: false,
warning: null,
}
case actions.LOCK_METAMASK:
return {
...appState,

@ -56,14 +56,6 @@ export default function reduceMetamask (state = {}, action) {
case actions.UPDATE_METAMASK_STATE:
return { ...metamaskState, ...action.value }
case actions.UNLOCK_METAMASK:
return {
...metamaskState,
isUnlocked: true,
isInitialized: true,
selectedAddress: action.value,
}
case actions.LOCK_METAMASK:
return {
...metamaskState,

@ -42,7 +42,6 @@ export const actionConstants = {
UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS',
UNLOCK_FAILED: 'UNLOCK_FAILED',
UNLOCK_SUCCEEDED: 'UNLOCK_SUCCEEDED',
UNLOCK_METAMASK: 'UNLOCK_METAMASK',
LOCK_METAMASK: 'LOCK_METAMASK',
// error handling
DISPLAY_WARNING: 'DISPLAY_WARNING',
@ -1260,13 +1259,6 @@ export function unlockSucceeded (message) {
}
}
export function unlockMetamask (account) {
return {
type: actionConstants.UNLOCK_METAMASK,
value: account,
}
}
export function updateMetamaskState (newState) {
return {
type: actionConstants.UPDATE_METAMASK_STATE,

Loading…
Cancel
Save