1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Merge pull request #8911 from MetaMask/Version-v8.0.2

Version v8.0.2
This commit is contained in:
Mark Stacey 2020-07-03 15:08:21 -03:00 committed by GitHub
commit 3eb6d157f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 55 additions and 30 deletions

View File

@ -2,6 +2,13 @@
## Current Develop Branch ## 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 ## 8.0.1 Thu Jul 02 2020
- [#8874](https://github.com/MetaMask/metamask-extension/pull/8874): Fx overflow behaviour of add token list - [#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 - [#8885](https://github.com/MetaMask/metamask-extension/pull/8885): Show `origin` in connect flow rather than site name

View File

@ -1,7 +1,7 @@
{ {
"name": "__MSG_appName__", "name": "__MSG_appName__",
"short_name": "__MSG_appName__", "short_name": "__MSG_appName__",
"version": "8.0.1", "version": "8.0.2",
"manifest_version": 2, "manifest_version": 2,
"author": "https://metamask.io", "author": "https://metamask.io",
"description": "__MSG_appDescription__", "description": "__MSG_appDescription__",

View File

@ -15,7 +15,7 @@ export const MAINNET_CHAIN_ID = '0x1'
export const ROPSTEN_CHAIN_ID = '0x3' export const ROPSTEN_CHAIN_ID = '0x3'
export const RINKEBY_CHAIN_ID = '0x4' export const RINKEBY_CHAIN_ID = '0x4'
export const GOERLI_CHAIN_ID = '0x5' 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 ROPSTEN_DISPLAY_NAME = 'Ropsten'
export const RINKEBY_DISPLAY_NAME = 'Rinkeby' export const RINKEBY_DISPLAY_NAME = 'Rinkeby'

View File

@ -89,4 +89,7 @@ const main = async () => {
} }
main() main()
.catch(console.error) .catch((error) => {
console.error(error)
process.exit(1)
})

View File

@ -11,7 +11,7 @@
"benchmark:firefox": "SELENIUM_BROWSER=firefox node test/e2e/benchmark.js", "benchmark:firefox": "SELENIUM_BROWSER=firefox node test/e2e/benchmark.js",
"build:test": "yarn build test", "build:test": "yarn build test",
"test": "yarn test:unit && yarn lint", "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'", "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", "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'", "dapp-forwarder": "concurrently -k -n forwarder,dapp -p '[{time}][{name}]' 'yarn forwarder' 'yarn dapp'",

View File

@ -82,7 +82,7 @@ describe('NetworkController', function () {
input: '0x4', input: '0x4',
expected: 'Rinkeby', expected: 'Rinkeby',
}, { }, {
input: '0x42', input: '0x2a',
expected: 'Kovan', expected: 'Kovan',
}, { }, {
input: 'ropsten', input: 'ropsten',

View File

@ -36,34 +36,32 @@ export default class TransactionActivityLog extends PureComponent {
global.platform.openTab({ url: etherscanUrl }) global.platform.openTab({ url: etherscanUrl })
} }
renderInlineRetry (index, activity) { renderInlineRetry (index) {
const { t } = this.context const { t } = this.context
const { inlineRetryIndex, primaryTransaction = {}, onRetry, isEarliestNonce } = this.props const { inlineRetryIndex, primaryTransaction = {}, onRetry, isEarliestNonce } = this.props
const { status } = primaryTransaction const { status } = primaryTransaction
const { id } = activity
return isEarliestNonce && status !== CONFIRMED_STATUS && index === inlineRetryIndex return isEarliestNonce && status !== CONFIRMED_STATUS && index === inlineRetryIndex
? ( ? (
<div <div
className="transaction-activity-log__action-link" className="transaction-activity-log__action-link"
onClick={() => onRetry(id)} onClick={onRetry}
> >
{ t('speedUpTransaction') } { t('speedUpTransaction') }
</div> </div>
) : null ) : null
} }
renderInlineCancel (index, activity) { renderInlineCancel (index) {
const { t } = this.context const { t } = this.context
const { inlineCancelIndex, primaryTransaction = {}, onCancel, isEarliestNonce } = this.props const { inlineCancelIndex, primaryTransaction = {}, onCancel, isEarliestNonce } = this.props
const { status } = primaryTransaction const { status } = primaryTransaction
const { id } = activity
return isEarliestNonce && status !== CONFIRMED_STATUS && index === inlineCancelIndex return isEarliestNonce && status !== CONFIRMED_STATUS && index === inlineCancelIndex
? ( ? (
<div <div
className="transaction-activity-log__action-link" className="transaction-activity-log__action-link"
onClick={() => onCancel(id)} onClick={onCancel}
> >
{ t('speedUpCancellation') } { t('speedUpCancellation') }
</div> </div>
@ -107,8 +105,8 @@ export default class TransactionActivityLog extends PureComponent {
> >
{ activityText } { activityText }
</div> </div>
{ this.renderInlineRetry(index, activity) } { this.renderInlineRetry(index) }
{ this.renderInlineCancel(index, activity) } { this.renderInlineCancel(index) }
</div> </div>
</div> </div>
) )

View File

@ -145,8 +145,6 @@ export default class TransactionListItemDetails extends PureComponent {
transactionGroup, transactionGroup,
showSpeedUp, showSpeedUp,
showRetry, showRetry,
onCancel,
onRetry,
recipientEns, recipientEns,
recipientAddress, recipientAddress,
rpcPrefs: { blockExplorerUrl } = {}, rpcPrefs: { blockExplorerUrl } = {},
@ -253,8 +251,8 @@ export default class TransactionListItemDetails extends PureComponent {
<TransactionActivityLog <TransactionActivityLog
transactionGroup={transactionGroup} transactionGroup={transactionGroup}
className="transaction-list-item-details__transaction-activity-log" className="transaction-list-item-details__transaction-activity-log"
onCancel={onCancel} onCancel={this.handleCancel}
onRetry={onRetry} onRetry={this.handleRetry}
isEarliestNonce={isEarliestNonce} isEarliestNonce={isEarliestNonce}
/> />
</div> </div>

View File

@ -43,7 +43,7 @@ export const getMessage = (localeCode, localeMessages, key, substitutions) => {
const hasSubstitutions = Boolean(substitutions && substitutions.length) const hasSubstitutions = Boolean(substitutions && substitutions.length)
const hasReactSubstitutions = hasSubstitutions && 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 // perform substitutions
if (hasSubstitutions) { if (hasSubstitutions) {
@ -55,10 +55,12 @@ export const getMessage = (localeCode, localeMessages, key, substitutions) => {
return part return part
} }
const substituteIndex = Number(subMatch[1]) - 1 const substituteIndex = Number(subMatch[1]) - 1
if (substitutions[substituteIndex]) { if (substitutions[substituteIndex] == null) {
return substitutions[substituteIndex] 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 phrase = hasReactSubstitutions

View File

@ -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}`) 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 () { it('should correctly render falsey substitutions', function () {
assert.throws( const result = t(TEST_KEY_4, [ 0, -0, '', false, NaN ])
() => { assert.equal(result, '0 - 0 - - false - NaN')
t(TEST_KEY_5, [ TEST_SUBSTITUTION_1, TEST_SUBSTITUTION_2 ]) })
},
Error, it('should render nothing for "null" and "undefined" substitutions', function () {
`Insufficient number of substitutions for message: '$1 - $2 - $3'` 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 () { it('should return the correct message when a single react substitution is made', function () {

View File

@ -3,6 +3,8 @@ import PropTypes from 'prop-types'
import Button from '../../components/ui/button' import Button from '../../components/ui/button'
import Identicon from '../../components/ui/identicon' import Identicon from '../../components/ui/identicon'
import TokenBalance from '../../components/ui/token-balance' 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 { export default class ConfirmAddSuggestedToken extends Component {
static contextTypes = { static contextTypes = {
@ -19,9 +21,23 @@ export default class ConfirmAddSuggestedToken extends Component {
} }
componentDidMount () { componentDidMount () {
this._checkPendingTokens()
}
componentDidUpdate () {
this._checkPendingTokens()
}
_checkPendingTokens () {
const { mostRecentOverviewPage, pendingTokens = {}, history } = this.props 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) history.push(mostRecentOverviewPage)
} }
} }
@ -122,6 +138,7 @@ export default class ConfirmAddSuggestedToken extends Component {
type="secondary" type="secondary"
large large
className="page-container__footer-button" className="page-container__footer-button"
disabled={pendingTokens.length === 0}
onClick={() => { onClick={() => {
addToken(pendingToken) addToken(pendingToken)
.then(() => removeSuggestedTokens()) .then(() => removeSuggestedTokens())