mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
select current address in permissions connect (#8811)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
This commit is contained in:
parent
0813cc5c88
commit
53e88b06b6
@ -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…
x
Reference in New Issue
Block a user