aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations/008.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-02-03 16:17:17 +0800
committerGitHub <noreply@github.com>2017-02-03 16:17:17 +0800
commit66be5ff2756e611c7af6973e704d27ce9bbd0d45 (patch)
tree43b5dcab6686e3db06218bfff17a943c72e6ddf3 /app/scripts/migrations/008.js
parent270808c206934cf7d75fefcdd092c9595de45f29 (diff)
parent970d4fd69519bab1de972839190a4ede888914bb (diff)
downloadtangerine-wallet-browser-66be5ff2756e611c7af6973e704d27ce9bbd0d45.tar
tangerine-wallet-browser-66be5ff2756e611c7af6973e704d27ce9bbd0d45.tar.gz
tangerine-wallet-browser-66be5ff2756e611c7af6973e704d27ce9bbd0d45.tar.bz2
tangerine-wallet-browser-66be5ff2756e611c7af6973e704d27ce9bbd0d45.tar.lz
tangerine-wallet-browser-66be5ff2756e611c7af6973e704d27ce9bbd0d45.tar.xz
tangerine-wallet-browser-66be5ff2756e611c7af6973e704d27ce9bbd0d45.tar.zst
tangerine-wallet-browser-66be5ff2756e611c7af6973e704d27ce9bbd0d45.zip
Merge pull request #1083 from MetaMask/kumavis-refactor6
Refactor round 6
Diffstat (limited to 'app/scripts/migrations/008.js')
-rw-r--r--app/scripts/migrations/008.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/scripts/migrations/008.js b/app/scripts/migrations/008.js
new file mode 100644
index 000000000..7f6e72ee6
--- /dev/null
+++ b/app/scripts/migrations/008.js
@@ -0,0 +1,36 @@
+const version = 8
+
+/*
+
+This migration breaks out the NoticeController substate
+
+*/
+
+const extend = require('xtend')
+
+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 = extend(state, {
+ NoticeController: {
+ noticesList: state.noticesList || [],
+ },
+ })
+ delete newState.noticesList
+
+ return newState
+}