aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/tx-utils.js6
-rw-r--r--app/scripts/migrations/012.js36
-rw-r--r--app/scripts/notice-controller.js1
3 files changed, 40 insertions, 3 deletions
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index c6814c05f..7988f83e9 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -63,7 +63,7 @@ module.exports = class txProviderUtils {
const initialGasLimitBn = hexToBn(initialGasLimitHex)
const blockGasLimitBn = hexToBn(blockGasLimitHex)
const bufferedGasLimitBn = initialGasLimitBn.muln(1.5)
-
+
// if initialGasLimit is above blockGasLimit, dont modify it
if (initialGasLimitBn.gt(blockGasLimitBn)) return bnToHex(initialGasLimitBn)
// if bufferedGasLimit is below blockGasLimit, use bufferedGasLimit
@@ -99,7 +99,7 @@ module.exports = class txProviderUtils {
txParams.from = normalize(txParams.from)
txParams.value = normalize(txParams.value)
txParams.data = normalize(txParams.data)
- txParams.gasLimit = normalize(txParams.gasLimit || txParams.gas)
+ txParams.gas = normalize(txParams.gas || txParams.gasLimit)
txParams.nonce = normalize(txParams.nonce)
// build ethTx
log.info(`Prepared tx for signing: ${JSON.stringify(txParams)}`)
@@ -134,4 +134,4 @@ function bnToHex(inputBn) {
function hexToBn(inputHex) {
return new BN(ethUtil.stripHexPrefix(inputHex), 16)
-} \ No newline at end of file
+}
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
+}
diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js
index 0d72760fe..57aad40c5 100644
--- a/app/scripts/notice-controller.js
+++ b/app/scripts/notice-controller.js
@@ -41,6 +41,7 @@ module.exports = class NoticeController extends EventEmitter {
var notices = this.getNoticesList()
var index = notices.findIndex((currentNotice) => currentNotice.id === noticeToMark.id)
notices[index].read = true
+ notices[index].body = ''
this.setNoticesList(notices)
const latestNotice = this.getLatestUnreadNotice()
cb(null, latestNotice)