aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorKevin Serrano <kevin.serrano@consensys.net>2017-03-23 22:15:59 +0800
committerKevin Serrano <kevin.serrano@consensys.net>2017-03-23 22:15:59 +0800
commit16c76d522960298476492b53a02d1b490b84b858 (patch)
tree5b6ccd4947c7891d731928ce54f3b5ac17b221ca /app/scripts
parentd99b5a9e5a1dfc62e16e6a80d51e8f3af5b289e4 (diff)
downloadtangerine-wallet-browser-16c76d522960298476492b53a02d1b490b84b858.tar
tangerine-wallet-browser-16c76d522960298476492b53a02d1b490b84b858.tar.gz
tangerine-wallet-browser-16c76d522960298476492b53a02d1b490b84b858.tar.bz2
tangerine-wallet-browser-16c76d522960298476492b53a02d1b490b84b858.tar.lz
tangerine-wallet-browser-16c76d522960298476492b53a02d1b490b84b858.tar.xz
tangerine-wallet-browser-16c76d522960298476492b53a02d1b490b84b858.tar.zst
tangerine-wallet-browser-16c76d522960298476492b53a02d1b490b84b858.zip
Create migration to erase body in read notices.
Diffstat (limited to 'app/scripts')
-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
+}