From 4d88e1cf862c3ae174780cd888d7703685db23e7 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Wed, 31 Jul 2019 17:47:11 -0230 Subject: Enable indent linting via ESLint (#6936) * Enable indent linting via ESLint * yarn run lint:fix --- app/scripts/migrations/018.js | 6 +++--- app/scripts/migrations/019.js | 10 +++++----- app/scripts/migrations/024.js | 2 +- app/scripts/migrations/031.js | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'app/scripts/migrations') diff --git a/app/scripts/migrations/018.js b/app/scripts/migrations/018.js index ffbf24a4b..f6442dacc 100644 --- a/app/scripts/migrations/018.js +++ b/app/scripts/migrations/018.js @@ -43,9 +43,9 @@ function transformState (state) { const newHistory = ( txStateHistoryHelper.migrateFromSnapshotsToDiffs(txMeta.history) // remove empty diffs - .filter((entry) => { - return !Array.isArray(entry) || entry.length > 0 - }) + .filter((entry) => { + return !Array.isArray(entry) || entry.length > 0 + }) ) txMeta.history = newHistory return txMeta diff --git a/app/scripts/migrations/019.js b/app/scripts/migrations/019.js index ce5da6859..7b726c3e8 100644 --- a/app/scripts/migrations/019.js +++ b/app/scripts/migrations/019.js @@ -38,13 +38,13 @@ function transformState (state) { if (txMeta.status !== 'submitted') return txMeta const confirmedTxs = txList.filter((tx) => tx.status === 'confirmed') - .filter((tx) => tx.txParams.from === txMeta.txParams.from) - .filter((tx) => tx.metamaskNetworkId.from === txMeta.metamaskNetworkId.from) + .filter((tx) => tx.txParams.from === txMeta.txParams.from) + .filter((tx) => tx.metamaskNetworkId.from === txMeta.metamaskNetworkId.from) const highestConfirmedNonce = getHighestNonce(confirmedTxs) const pendingTxs = txList.filter((tx) => tx.status === 'submitted') - .filter((tx) => tx.txParams.from === txMeta.txParams.from) - .filter((tx) => tx.metamaskNetworkId.from === txMeta.metamaskNetworkId.from) + .filter((tx) => tx.txParams.from === txMeta.txParams.from) + .filter((tx) => tx.metamaskNetworkId.from === txMeta.metamaskNetworkId.from) const highestContinuousNonce = getHighestContinuousFrom(pendingTxs, highestConfirmedNonce) const maxNonce = Math.max(highestContinuousNonce, highestConfirmedNonce) @@ -78,7 +78,7 @@ function getHighestContinuousFrom (txList, startPoint) { function getHighestNonce (txList) { const nonces = txList.map((txMeta) => { - const nonce = txMeta.txParams.nonce + const nonce = txMeta.txParams.nonce return parseInt(nonce || '0x0', 16) }) const highestNonce = Math.max.apply(null, nonces) diff --git a/app/scripts/migrations/024.js b/app/scripts/migrations/024.js index 6239bab13..5ffaea377 100644 --- a/app/scripts/migrations/024.js +++ b/app/scripts/migrations/024.js @@ -32,7 +32,7 @@ function transformState (state) { txMeta.status === 'unapproved' && txMeta.txParams && txMeta.txParams.from - ) { + ) { txMeta.txParams.from = txMeta.txParams.from.toLowerCase() } return txMeta diff --git a/app/scripts/migrations/031.js b/app/scripts/migrations/031.js index 98d182828..9c8cbeb09 100644 --- a/app/scripts/migrations/031.js +++ b/app/scripts/migrations/031.js @@ -2,14 +2,14 @@ const version = 31 const clone = require('clone') - /* +/* * The purpose of this migration is to properly set the completedOnboarding flag baesd on the state * of the KeyringController. */ module.exports = { version, - migrate: async function (originalVersionedData) { + migrate: async function (originalVersionedData) { const versionedData = clone(originalVersionedData) versionedData.meta.version = version const state = versionedData.data @@ -19,13 +19,13 @@ module.exports = { }, } - function transformState (state) { +function transformState (state) { const { KeyringController, PreferencesController } = state - if (KeyringController && PreferencesController) { + if (KeyringController && PreferencesController) { const { vault } = KeyringController PreferencesController.completedOnboarding = Boolean(vault) } - return state + return state } -- cgit From e9a63d5d5b428e8ace6423652d8691205bb129f0 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Thu, 1 Aug 2019 10:54:33 -0230 Subject: Default Privacy Mode to ON, allow force sharing address (#6904) --- app/scripts/migrations/034.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 app/scripts/migrations/034.js (limited to 'app/scripts/migrations') diff --git a/app/scripts/migrations/034.js b/app/scripts/migrations/034.js new file mode 100644 index 000000000..7c852de96 --- /dev/null +++ b/app/scripts/migrations/034.js @@ -0,0 +1,33 @@ +const version = 34 +const clone = require('clone') + +/** + * The purpose of this migration is to enable the {@code privacyMode} feature flag and set the user as being migrated + * if it was {@code false}. + */ +module.exports = { + version, + migrate: async function (originalVersionedData) { + const versionedData = clone(originalVersionedData) + versionedData.meta.version = version + const state = versionedData.data + versionedData.data = transformState(state) + return versionedData + }, +} + +function transformState (state) { + const { PreferencesController } = state + + if (PreferencesController) { + const featureFlags = PreferencesController.featureFlags || {} + + if (!featureFlags.privacyMode && typeof PreferencesController.migratedPrivacyMode === 'undefined') { + // Mark the state has being migrated and enable Privacy Mode + PreferencesController.migratedPrivacyMode = true + featureFlags.privacyMode = true + } + } + + return state +} -- cgit From bb87a0b92ce2392ef0d0dc173fb094513ddb10f7 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 2 Aug 2019 10:28:25 -0230 Subject: Add migration to remove `seedWords` state (#6937) The `seedWords` state was removed from the PreferencesController recently in #6920. That state hadn't been used in some time, and there was a long period during which `seedWords` was periodically scrubbed from the state, so it's highly unlikely that it still exists in state for most users. It's hard to guarantee that it _doesn't_ though, especially if a user hasn't opened MetaMask in a few months. --- app/scripts/migrations/035.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 app/scripts/migrations/035.js (limited to 'app/scripts/migrations') diff --git a/app/scripts/migrations/035.js b/app/scripts/migrations/035.js new file mode 100644 index 000000000..02b01f588 --- /dev/null +++ b/app/scripts/migrations/035.js @@ -0,0 +1,28 @@ +// next version number +const version = 35 + +/* + +Removes the deprecated 'seedWords' state + +*/ + +const clone = require('clone') + +module.exports = { + version, + + migrate: async function (originalVersionedData) { + const versionedData = clone(originalVersionedData) + versionedData.meta.version = version + versionedData.data = transformState(versionedData.data) + return versionedData + }, +} + +function transformState (state) { + if (state.PreferencesController && state.PreferencesController.seedWords !== undefined) { + delete state.PreferencesController.seedWords + } + return state +} -- cgit