mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add migrations for removing terms of use data.
This commit is contained in:
parent
ec8aa3d1f2
commit
cd75d86187
30
app/scripts/migrations/011.js
Normal file
30
app/scripts/migrations/011.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
const version = 11
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
This migration breaks out the CurrencyController substate
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
version,
|
||||||
|
|
||||||
|
migrate: function (versionedData) {
|
||||||
|
versionedData.meta.version = version
|
||||||
|
try {
|
||||||
|
const state = versionedData.data
|
||||||
|
const newState = transformState(state)
|
||||||
|
versionedData.data = newState
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`MetaMask Migration #${version}` + err.stack)
|
||||||
|
}
|
||||||
|
return Promise.resolve(versionedData)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformState (state) {
|
||||||
|
const newState = state
|
||||||
|
delete newState.TOSHash
|
||||||
|
delete newState.isDisclaimerConfirmed
|
||||||
|
return newState
|
||||||
|
}
|
@ -21,4 +21,5 @@ module.exports = [
|
|||||||
require('./008'),
|
require('./008'),
|
||||||
require('./009'),
|
require('./009'),
|
||||||
require('./010'),
|
require('./010'),
|
||||||
|
require('./011'),
|
||||||
]
|
]
|
||||||
|
@ -6,6 +6,7 @@ const wallet1 = require(path.join('..', 'lib', 'migrations', '001.json'))
|
|||||||
const migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002'))
|
const migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002'))
|
||||||
const migration3 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '003'))
|
const migration3 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '003'))
|
||||||
const migration4 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '004'))
|
const migration4 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '004'))
|
||||||
|
const migration11 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '011'))
|
||||||
|
|
||||||
const oldTestRpc = 'https://rawtestrpc.metamask.io/'
|
const oldTestRpc = 'https://rawtestrpc.metamask.io/'
|
||||||
const newTestRpc = 'https://testrpc.metamask.io/'
|
const newTestRpc = 'https://testrpc.metamask.io/'
|
||||||
@ -27,8 +28,11 @@ describe('wallet1 is migrated successfully', function() {
|
|||||||
}).then((thirdResult) => {
|
}).then((thirdResult) => {
|
||||||
assert.equal(thirdResult.data.config.provider.rpcTarget, null)
|
assert.equal(thirdResult.data.config.provider.rpcTarget, null)
|
||||||
assert.equal(thirdResult.data.config.provider.type, 'testnet')
|
assert.equal(thirdResult.data.config.provider.type, 'testnet')
|
||||||
|
return migration11.migrate(thirdResult)
|
||||||
|
}).then((eleventhResult) => {
|
||||||
|
assert.equal(eleventhResult.data.isDisclaimerConfirmed, null)
|
||||||
|
assert.equal(eleventhResult.data.TOSHash, null)
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user