1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Remove unused transForward state and actions (#8401)

The `transForward` app state is no longer used, so it has been removed.
Associated actions have been removed as well.

This state dates back a few years, so I was unable to determine when it
was made obsolete.
This commit is contained in:
Mark Stacey 2020-04-23 20:32:08 -03:00 committed by GitHub
parent 24a8689090
commit 3620146e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 2 additions and 51 deletions

View File

@ -175,7 +175,6 @@
"modalState": {},
"previousModalState": {}
},
"transForward": true,
"isLoading": false,
"warning": null,
"scrollToBottom": false,

View File

@ -135,7 +135,6 @@
"modalState": {},
"previousModalState": {}
},
"transForward": true,
"isLoading": false,
"warning": null,
"scrollToBottom": false,

View File

@ -1078,7 +1078,6 @@
"previousModalState": {}
},
"sidebar": {},
"transForward": true,
"isLoading": false,
"warning": null,
"scrollToBottom": false,

View File

@ -779,7 +779,7 @@ describe('Actions', function () {
const store = mockStore()
const expectedActions = [
{ type: 'DISPLAY_WARNING', value: 'error' },
{ type: 'SHOW_CONF_TX_PAGE', transForward: true, id: undefined },
{ type: 'SHOW_CONF_TX_PAGE', id: undefined },
]
sendTransactionSpy.callsFake((_, callback) => {
callback(new Error('error'))

View File

@ -127,20 +127,11 @@ describe('App State', function () {
assert.equal(newState.modal.modalState.name, null)
})
it('transitions forwards', function () {
const state = reduceApp(metamaskState, {
type: actions.TRANSITION_FORWARD,
})
assert.equal(state.transForward, true)
})
it('shows send token page', function () {
const state = reduceApp(metamaskState, {
type: actions.SHOW_SEND_TOKEN_PAGE,
})
assert.equal(state.transForward, true)
assert.equal(state.warning, null)
})
@ -149,7 +140,6 @@ describe('App State', function () {
type: actions.LOCK_METAMASK,
})
assert.equal(state.transForward, false)
assert.equal(state.warning, null)
})
@ -161,7 +151,6 @@ describe('App State', function () {
assert.equal(state.accountDetail.subview, 'transactions')
assert.equal(state.accountDetail.accountExport, 'none')
assert.equal(state.accountDetail.privateKey, '')
assert.equal(state.transForward, false)
assert.equal(state.warning, null)
})
@ -175,7 +164,6 @@ describe('App State', function () {
assert.equal(state.accountDetail.subview, 'transactions') // default
assert.equal(state.accountDetail.accountExport, 'none') // default
assert.equal(state.accountDetail.privateKey, '') // default
assert.equal(state.transForward, false)
})
@ -184,7 +172,6 @@ describe('App State', function () {
type: actions.SHOW_ACCOUNTS_PAGE,
})
assert.equal(state.transForward, true)
assert.equal(state.isLoading, false)
assert.equal(state.warning, null)
assert.equal(state.scrollToBottom, false)
@ -206,11 +193,9 @@ describe('App State', function () {
const state = reduceApp(oldState, {
type: actions.SHOW_CONF_TX_PAGE,
id: 2,
transForward: false,
})
assert.equal(state.txId, 2)
assert.equal(state.transForward, false)
assert.equal(state.warning, null)
assert.equal(state.isLoading, false)
@ -238,7 +223,6 @@ describe('App State', function () {
})
assert.equal(state.txId, null)
assert.equal(state.transForward, false)
assert.equal(state.warning, null)
})
@ -250,7 +234,6 @@ describe('App State', function () {
},
})
assert.equal(state.transForward, false)
assert.equal(state.warning, null)
assert.equal(state.accountDetail.subview, 'transactions')
})

View File

@ -31,8 +31,6 @@ export default function reduceApp (state = {}, action) {
accountDetail: {
subview: 'transactions',
},
// Used to render transition direction
transForward: true,
// Used to display loading indicator
isLoading: false,
// Used to display error text
@ -138,13 +136,6 @@ export default function reduceApp (state = {}, action) {
),
}
// transition methods
case actionConstants.TRANSITION_FORWARD:
return {
...appState,
transForward: true,
}
case actionConstants.FORGOT_PASSWORD:
return {
...appState,
@ -154,14 +145,12 @@ export default function reduceApp (state = {}, action) {
case actionConstants.SHOW_SEND_TOKEN_PAGE:
return {
...appState,
transForward: true,
warning: null,
}
case actionConstants.LOCK_METAMASK:
return {
...appState,
transForward: false,
warning: null,
}
@ -175,7 +164,6 @@ export default function reduceApp (state = {}, action) {
accountExport: 'none',
privateKey: '',
},
transForward: false,
warning: null,
}
@ -188,13 +176,11 @@ export default function reduceApp (state = {}, action) {
accountExport: 'none',
privateKey: '',
},
transForward: false,
}
case actionConstants.SHOW_ACCOUNTS_PAGE:
return {
...appState,
transForward: true,
isLoading: false,
warning: null,
scrollToBottom: false,
@ -205,7 +191,6 @@ export default function reduceApp (state = {}, action) {
return {
...appState,
txId: action.id,
transForward: action.transForward,
warning: null,
isLoading: false,
}
@ -214,7 +199,6 @@ export default function reduceApp (state = {}, action) {
if (action.value.unconfirmedActionsCount > 0) {
return {
...appState,
transForward: false,
txId: null,
warning: null,
}
@ -223,7 +207,6 @@ export default function reduceApp (state = {}, action) {
...appState,
// indicate notification should close
shouldClose: true,
transForward: false,
warning: null,
txId: null,
accountDetail: {

View File

@ -223,7 +223,6 @@ export default {
'modalState': {},
'previousModalState': {},
},
'transForward': true,
'isLoading': false,
'warning': null,
'scrollToBottom': false,

View File

@ -224,7 +224,6 @@ export default {
'modalState': {},
'previousModalState': {},
},
'transForward': true,
'isLoading': false,
'warning': null,
'scrollToBottom': false,

View File

@ -16,8 +16,6 @@ export default {
// network dropdown open
NETWORK_DROPDOWN_OPEN: 'UI_NETWORK_DROPDOWN_OPEN',
NETWORK_DROPDOWN_CLOSE: 'UI_NETWORK_DROPDOWN_CLOSE',
// transition state
TRANSITION_FORWARD: 'TRANSITION_FORWARD',
// remote state
UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE',
FORGOT_PASSWORD: 'FORGOT_PASSWORD',

View File

@ -63,7 +63,6 @@ export function tryUnlockMetamask (password) {
})
})
.then(() => {
dispatch(transitionForward())
dispatch(hideLoadingIndication())
})
.catch((err) => {
@ -74,12 +73,6 @@ export function tryUnlockMetamask (password) {
}
}
export function transitionForward () {
return {
type: actionConstants.TRANSITION_FORWARD,
}
}
export function createNewVaultAndRestore (password, seed) {
return (dispatch) => {
dispatch(showLoadingIndication())
@ -1259,10 +1252,9 @@ export function showAccountsPage () {
}
}
export function showConfTxPage ({ transForward = true, id } = {}) {
export function showConfTxPage ({ id } = {}) {
return {
type: actionConstants.SHOW_CONF_TX_PAGE,
transForward,
id,
}
}