diff --git a/CHANGELOG.md b/CHANGELOG.md index c80389505..5b8c56d71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Current Develop Branch +## 8.0.2 Fri Jul 03 2020 +- [#8907](https://github.com/MetaMask/metamask-extension/pull/8907): Tolerate missing or falsey substitutions +- [#8908](https://github.com/MetaMask/metamask-extension/pull/8908): Fix activity log inline buttons +- [#8909](https://github.com/MetaMask/metamask-extension/pull/8909): Prevent confirming blank suggested token +- [#8910](https://github.com/MetaMask/metamask-extension/pull/8910): Handle suggested token resolved elsewhere +- [#8913](https://github.com/MetaMask/metamask-extension/pull/8913): Fix Kovan chain ID constant + ## 8.0.1 Thu Jul 02 2020 - [#8874](https://github.com/MetaMask/metamask-extension/pull/8874): Fx overflow behaviour of add token list - [#8885](https://github.com/MetaMask/metamask-extension/pull/8885): Show `origin` in connect flow rather than site name diff --git a/app/manifest/_base.json b/app/manifest/_base.json index 1d567a273..6f054b6db 100644 --- a/app/manifest/_base.json +++ b/app/manifest/_base.json @@ -1,7 +1,7 @@ { "name": "__MSG_appName__", "short_name": "__MSG_appName__", - "version": "8.0.1", + "version": "8.0.2", "manifest_version": 2, "author": "https://metamask.io", "description": "__MSG_appDescription__", diff --git a/app/scripts/controllers/network/enums.js b/app/scripts/controllers/network/enums.js index e2a7deab3..13bdbbe1a 100644 --- a/app/scripts/controllers/network/enums.js +++ b/app/scripts/controllers/network/enums.js @@ -15,7 +15,7 @@ export const MAINNET_CHAIN_ID = '0x1' export const ROPSTEN_CHAIN_ID = '0x3' export const RINKEBY_CHAIN_ID = '0x4' export const GOERLI_CHAIN_ID = '0x5' -export const KOVAN_CHAIN_ID = '0x42' +export const KOVAN_CHAIN_ID = '0x2a' export const ROPSTEN_DISPLAY_NAME = 'Ropsten' export const RINKEBY_DISPLAY_NAME = 'Rinkeby' diff --git a/development/static-server.js b/development/static-server.js index d8f22cabe..e07c2e33f 100644 --- a/development/static-server.js +++ b/development/static-server.js @@ -89,4 +89,7 @@ const main = async () => { } main() - .catch(console.error) + .catch((error) => { + console.error(error) + process.exit(1) + }) diff --git a/package.json b/package.json index 48bf624c7..1680de795 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "benchmark:firefox": "SELENIUM_BROWSER=firefox node test/e2e/benchmark.js", "build:test": "yarn build test", "test": "yarn test:unit && yarn lint", - "dapp": "node development/static-server.js node_modules/@metamask/test-dapp/website --port 8080", + "dapp": "node development/static-server.js node_modules/@metamask/test-dapp/dist --port 8080", "dapp-chain": "GANACHE_ARGS='-b 2' concurrently -k -n ganache,dapp -p '[{time}][{name}]' 'yarn ganache:start' 'sleep 5 && yarn dapp'", "forwarder": "node ./development/static-server.js ./node_modules/@metamask/forwarder/dist/ --port 9010", "dapp-forwarder": "concurrently -k -n forwarder,dapp -p '[{time}][{name}]' 'yarn forwarder' 'yarn dapp'", diff --git a/test/unit/app/controllers/network/network-controller-test.js b/test/unit/app/controllers/network/network-controller-test.js index e081204be..14d3bf31f 100644 --- a/test/unit/app/controllers/network/network-controller-test.js +++ b/test/unit/app/controllers/network/network-controller-test.js @@ -82,7 +82,7 @@ describe('NetworkController', function () { input: '0x4', expected: 'Rinkeby', }, { - input: '0x42', + input: '0x2a', expected: 'Kovan', }, { input: 'ropsten', diff --git a/ui/app/components/app/transaction-activity-log/transaction-activity-log.component.js b/ui/app/components/app/transaction-activity-log/transaction-activity-log.component.js index b5618b83b..4a9a9791e 100644 --- a/ui/app/components/app/transaction-activity-log/transaction-activity-log.component.js +++ b/ui/app/components/app/transaction-activity-log/transaction-activity-log.component.js @@ -36,34 +36,32 @@ export default class TransactionActivityLog extends PureComponent { global.platform.openTab({ url: etherscanUrl }) } - renderInlineRetry (index, activity) { + renderInlineRetry (index) { const { t } = this.context const { inlineRetryIndex, primaryTransaction = {}, onRetry, isEarliestNonce } = this.props const { status } = primaryTransaction - const { id } = activity return isEarliestNonce && status !== CONFIRMED_STATUS && index === inlineRetryIndex ? (
onRetry(id)} + onClick={onRetry} > { t('speedUpTransaction') }
) : null } - renderInlineCancel (index, activity) { + renderInlineCancel (index) { const { t } = this.context const { inlineCancelIndex, primaryTransaction = {}, onCancel, isEarliestNonce } = this.props const { status } = primaryTransaction - const { id } = activity return isEarliestNonce && status !== CONFIRMED_STATUS && index === inlineCancelIndex ? (
onCancel(id)} + onClick={onCancel} > { t('speedUpCancellation') }
@@ -107,8 +105,8 @@ export default class TransactionActivityLog extends PureComponent { > { activityText } - { this.renderInlineRetry(index, activity) } - { this.renderInlineCancel(index, activity) } + { this.renderInlineRetry(index) } + { this.renderInlineCancel(index) } ) diff --git a/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js b/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js index b0ea259db..cc5418860 100644 --- a/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js +++ b/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js @@ -145,8 +145,6 @@ export default class TransactionListItemDetails extends PureComponent { transactionGroup, showSpeedUp, showRetry, - onCancel, - onRetry, recipientEns, recipientAddress, rpcPrefs: { blockExplorerUrl } = {}, @@ -253,8 +251,8 @@ export default class TransactionListItemDetails extends PureComponent { diff --git a/ui/app/helpers/utils/i18n-helper.js b/ui/app/helpers/utils/i18n-helper.js index 01a369229..a32120b4f 100644 --- a/ui/app/helpers/utils/i18n-helper.js +++ b/ui/app/helpers/utils/i18n-helper.js @@ -43,7 +43,7 @@ export const getMessage = (localeCode, localeMessages, key, substitutions) => { const hasSubstitutions = Boolean(substitutions && substitutions.length) const hasReactSubstitutions = hasSubstitutions && - substitutions.some((element) => typeof element === 'function' || typeof element === 'object') + substitutions.some((element) => element !== null && (typeof element === 'function' || typeof element === 'object')) // perform substitutions if (hasSubstitutions) { @@ -55,10 +55,12 @@ export const getMessage = (localeCode, localeMessages, key, substitutions) => { return part } const substituteIndex = Number(subMatch[1]) - 1 - if (substitutions[substituteIndex]) { - return substitutions[substituteIndex] + if (substitutions[substituteIndex] == null) { + const error = new Error(`Insufficient number of substitutions for message: '${phrase}'`) + log.error(error) + Sentry.captureException(error) } - throw new Error(`Insufficient number of substitutions for message: '${phrase}'`) + return substitutions[substituteIndex] }) phrase = hasReactSubstitutions diff --git a/ui/app/helpers/utils/i18n-helper.test.js b/ui/app/helpers/utils/i18n-helper.test.js index 2832022e6..4531865ab 100644 --- a/ui/app/helpers/utils/i18n-helper.test.js +++ b/ui/app/helpers/utils/i18n-helper.test.js @@ -132,14 +132,14 @@ describe('i18n helper', function () { assert.equal(result, `${TEST_SUBSTITUTION_1} - ${TEST_SUBSTITUTION_2} - ${TEST_SUBSTITUTION_3} - ${TEST_SUBSTITUTION_4} - ${TEST_SUBSTITUTION_5}`) }) - it('should throw an error when not passed as many substitutions as a message requires', function () { - assert.throws( - () => { - t(TEST_KEY_5, [ TEST_SUBSTITUTION_1, TEST_SUBSTITUTION_2 ]) - }, - Error, - `Insufficient number of substitutions for message: '$1 - $2 - $3'` - ) + it('should correctly render falsey substitutions', function () { + const result = t(TEST_KEY_4, [ 0, -0, '', false, NaN ]) + assert.equal(result, '0 - 0 - - false - NaN') + }) + + it('should render nothing for "null" and "undefined" substitutions', function () { + const result = t(TEST_KEY_5, [ null, TEST_SUBSTITUTION_2 ]) + assert.equal(result, ` - ${TEST_SUBSTITUTION_2} - `) }) it('should return the correct message when a single react substitution is made', function () { diff --git a/ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js b/ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js index f6c47f894..876fbd761 100644 --- a/ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js +++ b/ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js @@ -3,6 +3,8 @@ import PropTypes from 'prop-types' import Button from '../../components/ui/button' import Identicon from '../../components/ui/identicon' import TokenBalance from '../../components/ui/token-balance' +import { getEnvironmentType } from '../../../../app/scripts/lib/util' +import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../app/scripts/lib/enums' export default class ConfirmAddSuggestedToken extends Component { static contextTypes = { @@ -19,9 +21,23 @@ export default class ConfirmAddSuggestedToken extends Component { } componentDidMount () { + this._checkPendingTokens() + } + + componentDidUpdate () { + this._checkPendingTokens() + } + + _checkPendingTokens () { const { mostRecentOverviewPage, pendingTokens = {}, history } = this.props - if (Object.keys(pendingTokens).length === 0) { + if (Object.keys(pendingTokens).length > 0) { + return + } + + if (getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION) { + global.platform.closeCurrentWindow() + } else { history.push(mostRecentOverviewPage) } } @@ -122,6 +138,7 @@ export default class ConfirmAddSuggestedToken extends Component { type="secondary" large className="page-container__footer-button" + disabled={pendingTokens.length === 0} onClick={() => { addToken(pendingToken) .then(() => removeSuggestedTokens())