From 3d9bedaeea9b0485b7cfbe3255d72cfe470bcaa2 Mon Sep 17 00:00:00 2001 From: Frankie Date: Mon, 27 Jun 2016 17:07:45 -0700 Subject: [PATCH 1/7] Fix it so you cant send a negitavie amount of ETH --- ui/app/send.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/app/send.js b/ui/app/send.js index 4b501a7b5..540d85382 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -216,6 +216,11 @@ SendTransactionScreen.prototype.onSubmit = function () { return this.props.dispatch(actions.displayWarning(message)) } + if (input < 0) { + message = 'Can not send negative amounts of ETH.' + return this.props.dispatch(actions.displayWarning(message)) + } + if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) { message = 'Recipient address is invalid.' return this.props.dispatch(actions.displayWarning(message)) @@ -234,4 +239,3 @@ SendTransactionScreen.prototype.onSubmit = function () { this.props.dispatch(actions.signTx(txParams)) } - From 86a1eaadf188b0879ae41a5fa125649ad51f0118 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 28 Jun 2016 11:30:55 -0700 Subject: [PATCH 2/7] Enforce 30 character limit on wallet name. --- CHANGELOG.md | 1 + ui/app/components/editable-label.js | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 113bf1ab7..86671c9cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed bug where MetaMask interfered with PDF loading. - Moved switch account icon into menu bar. +- Now enforce 30 character limit on wallet names. ## 2.4.4 2016-06-23 diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js index 3d7ca17d4..6b3e8cb28 100644 --- a/ui/app/components/editable-label.js +++ b/ui/app/components/editable-label.js @@ -18,6 +18,7 @@ EditableLabel.prototype.render = function () { return h('div.editable-label', [ h('input.sizing-input', { defaultValue: props.textValue, + maxLength: "30", onKeyPress: (event) => { this.saveIfEnter(event) }, From a69882df720afd47fda4f238a77d97c81aaa0cdf Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 28 Jun 2016 11:34:30 -0700 Subject: [PATCH 3/7] Additional length check just in case. --- ui/app/components/editable-label.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js index 6b3e8cb28..34fd7e3e0 100644 --- a/ui/app/components/editable-label.js +++ b/ui/app/components/editable-label.js @@ -45,6 +45,7 @@ EditableLabel.prototype.saveIfEnter = function (event) { EditableLabel.prototype.saveText = function () { var container = findDOMNode(this) var text = container.querySelector('.editable-label input').value - this.props.saveText(text) - this.setState({ isEditingLabel: false, textLabel: text }) + var truncatedText = text.substring(0,30) + this.props.saveText(truncatedText) + this.setState({ isEditingLabel: false, textLabel: truncatedText }) } From 4f4c5048bf386c7d8e93592644bcda99e0fc38ea Mon Sep 17 00:00:00 2001 From: Frankie Date: Tue, 28 Jun 2016 11:57:33 -0700 Subject: [PATCH 4/7] fix #341 close notifications when oppening pop up --- app/scripts/lib/notifications.js | 4 ++-- ui/app/app.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js index a5746ae6e..a31949108 100644 --- a/app/scripts/lib/notifications.js +++ b/app/scripts/lib/notifications.js @@ -176,7 +176,7 @@ function renderNotificationSVG(content, cb){ } function svgWrapper(content){ - var wrapperSource = ` + var wrapperSource = ` {{content}} @@ -188,4 +188,4 @@ function svgWrapper(content){ function toSvgUri(content){ return 'data:image/svg+xml;utf8,' + encodeURIComponent(content) -} \ No newline at end of file +} diff --git a/ui/app/app.js b/ui/app/app.js index a07118ddb..f505c89c0 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -324,6 +324,7 @@ App.prototype.renderPrimary = function () { return h(SendTransactionScreen, {key: 'send-transaction'}) case 'confTx': + this.clearNotifications() return h(ConfirmTxScreen, {key: 'confirm-tx'}) case 'config': @@ -355,3 +356,10 @@ App.prototype.toggleMetamaskActive = function () { } } +App.prototype.clearNotifications = function () { + chrome.notifications.getAll( function (object) { + for (let notification in object){ + chrome.notifications.clear(notification) + } + }) +}; From c11520306366ec4a3d75c7ee48f6c1b1dd56399e Mon Sep 17 00:00:00 2001 From: Frankie Date: Tue, 28 Jun 2016 12:08:30 -0700 Subject: [PATCH 5/7] fix for linting --- ui/app/app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/app/app.js b/ui/app/app.js index 1ae579664..ef436d4e3 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -358,9 +358,9 @@ App.prototype.toggleMetamaskActive = function () { } App.prototype.clearNotifications = function () { - chrome.notifications.getAll( function (object) { - for (let notification in object){ - chrome.notifications.clear(notification) - } + chrome.notifications.getAll(function (object) { + for (let notification in object){ + chrome.notifications.clear(notification) + } }) -}; +} From abcf7621847220f0709eb37cca0fd93cd0632bd5 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 28 Jun 2016 12:49:17 -0700 Subject: [PATCH 6/7] Code style fix. --- ui/app/components/editable-label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js index 34fd7e3e0..05ffd4c92 100644 --- a/ui/app/components/editable-label.js +++ b/ui/app/components/editable-label.js @@ -18,7 +18,7 @@ EditableLabel.prototype.render = function () { return h('div.editable-label', [ h('input.sizing-input', { defaultValue: props.textValue, - maxLength: "30", + maxLength: '30', onKeyPress: (event) => { this.saveIfEnter(event) }, @@ -45,7 +45,7 @@ EditableLabel.prototype.saveIfEnter = function (event) { EditableLabel.prototype.saveText = function () { var container = findDOMNode(this) var text = container.querySelector('.editable-label input').value - var truncatedText = text.substring(0,30) + var truncatedText = text.substring(0, 30) this.props.saveText(truncatedText) this.setState({ isEditingLabel: false, textLabel: truncatedText }) } From 16566ee7dbe00c40941b0ed3c7f3b96179cae3aa Mon Sep 17 00:00:00 2001 From: Frankie Date: Tue, 28 Jun 2016 12:57:06 -0700 Subject: [PATCH 7/7] Move clearNotifications to popup.js --- app/scripts/popup.js | 10 ++++++++++ ui/app/app.js | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/scripts/popup.js b/app/scripts/popup.js index 5173507fa..5c5cf0455 100644 --- a/app/scripts/popup.js +++ b/app/scripts/popup.js @@ -65,11 +65,21 @@ function getCurrentDomain (cb) { }) } +function clearNotifications(){ + chrome.notifications.getAll(function (object) { + for (let notification in object){ + chrome.notifications.clear(notification) + } + }) +} + function setupApp (err, opts) { if (err) { alert(err.stack) throw err } + + clearNotifications() var container = document.getElementById('app-content') diff --git a/ui/app/app.js b/ui/app/app.js index ef436d4e3..80521d220 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -325,7 +325,6 @@ App.prototype.renderPrimary = function () { return h(SendTransactionScreen, {key: 'send-transaction'}) case 'confTx': - this.clearNotifications() return h(ConfirmTxScreen, {key: 'confirm-tx'}) case 'config': @@ -356,11 +355,3 @@ App.prototype.toggleMetamaskActive = function () { this.props.dispatch(actions.lockMetamask(false)) } } - -App.prototype.clearNotifications = function () { - chrome.notifications.getAll(function (object) { - for (let notification in object){ - chrome.notifications.clear(notification) - } - }) -}