select current address in permissions connect (#8811)

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
feature/default_network_editable
Brad Decker 5 years ago committed by GitHub
parent 0813cc5c88
commit 53e88b06b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      test/e2e/metamask-ui.spec.js
  2. 5
      ui/app/pages/permissions-connect/permissions-connect.component.js
  3. 3
      ui/app/pages/permissions-connect/permissions-connect.container.js

@ -415,8 +415,6 @@ describe('MetaMask', function () {
await driver.delay(regularDelayMs) await driver.delay(regularDelayMs)
await driver.clickElement(By.css('.permissions-connect-choose-account__account'))
await driver.clickElement(By.xpath(`//button[contains(text(), 'Next')]`)) await driver.clickElement(By.xpath(`//button[contains(text(), 'Next')]`))
await driver.clickElement(By.xpath(`//button[contains(text(), 'Connect')]`)) await driver.clickElement(By.xpath(`//button[contains(text(), 'Connect')]`))

@ -17,6 +17,7 @@ export default class PermissionConnect extends Component {
getRequestAccountTabIds: PropTypes.func.isRequired, getRequestAccountTabIds: PropTypes.func.isRequired,
getCurrentWindowTab: PropTypes.func.isRequired, getCurrentWindowTab: PropTypes.func.isRequired,
accounts: PropTypes.array.isRequired, accounts: PropTypes.array.isRequired,
currentAddress: PropTypes.string.isRequired,
origin: PropTypes.string, origin: PropTypes.string,
showNewAccountModal: PropTypes.func.isRequired, showNewAccountModal: PropTypes.func.isRequired,
newAccountNumber: PropTypes.number.isRequired, newAccountNumber: PropTypes.number.isRequired,
@ -46,9 +47,7 @@ export default class PermissionConnect extends Component {
state = { state = {
redirecting: false, redirecting: false,
selectedAccountAddresses: this.props.accounts.length === 1 selectedAccountAddresses: new Set([this.props.currentAddress]),
? new Set([this.props.accounts[0].address])
: new Set(),
permissionsApproved: null, permissionsApproved: null,
origin: this.props.origin, origin: this.props.origin,
targetDomainMetadata: this.props.targetDomainMetadata || {}, targetDomainMetadata: this.props.targetDomainMetadata || {},

@ -7,6 +7,7 @@ import {
getAccountsWithLabels, getAccountsWithLabels,
getLastConnectedInfo, getLastConnectedInfo,
getTargetDomainMetadata, getTargetDomainMetadata,
getSelectedAddress,
} from '../../selectors' } from '../../selectors'
import { formatDate } from '../../helpers/utils/util' import { formatDate } from '../../helpers/utils/util'
@ -28,6 +29,7 @@ const mapStateToProps = (state, ownProps) => {
location: { pathname }, location: { pathname },
} = ownProps } = ownProps
const permissionsRequests = getPermissionsRequests(state) const permissionsRequests = getPermissionsRequests(state)
const currentAddress = getSelectedAddress(state)
const permissionsRequest = permissionsRequests const permissionsRequest = permissionsRequests
.find((permissionsRequest) => permissionsRequest.metadata.id === permissionsRequestId) .find((permissionsRequest) => permissionsRequest.metadata.id === permissionsRequestId)
@ -68,6 +70,7 @@ const mapStateToProps = (state, ownProps) => {
permissionsRequestId, permissionsRequestId,
hasPendingPermissionsRequests, hasPendingPermissionsRequests,
accounts: accountsWithLabels, accounts: accountsWithLabels,
currentAddress,
origin, origin,
newAccountNumber: accountsWithLabels.length + 1, newAccountNumber: accountsWithLabels.length + 1,
nativeCurrency, nativeCurrency,

Loading…
Cancel
Save