aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations/012.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-03-29 09:02:39 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-03-29 09:02:39 +0800
commita20a237282c38da86b03625d08b48c2e58e83523 (patch)
tree65c58173cf8e0da53dbb6b9f18014ed8c1babf9c /app/scripts/migrations/012.js
parent79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd (diff)
parent7c09bde4120d1063df762076d41d2e9921dd3c0e (diff)
downloadtangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.gz
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.bz2
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.lz
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.xz
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.zst
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.zip
Merge branch 'master' into mascara
Diffstat (limited to 'app/scripts/migrations/012.js')
-rw-r--r--app/scripts/migrations/012.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/scripts/migrations/012.js b/app/scripts/migrations/012.js
new file mode 100644
index 000000000..8361b3793
--- /dev/null
+++ b/app/scripts/migrations/012.js
@@ -0,0 +1,36 @@
+const version = 12
+
+/*
+
+This migration modifies our notices to delete their body after being read.
+
+*/
+
+const clone = require('clone')
+
+module.exports = {
+ version,
+
+ migrate: function (originalVersionedData) {
+ let versionedData = clone(originalVersionedData)
+ 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
+ newState.NoticeController.noticesList.forEach((notice) => {
+ if (notice.read) {
+ notice.body = ''
+ }
+ })
+ return newState
+}