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.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(), 'Connect')]`))

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

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

Loading…
Cancel
Save