mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
delete targetDomainMetadata selector
This commit is contained in:
parent
d79bf8db2e
commit
28cf728067
@ -1,19 +1,14 @@
|
||||
import { connect } from 'react-redux'
|
||||
import PermissionPageContainer from './permission-page-container.component'
|
||||
import {
|
||||
getTargetDomainMetadata,
|
||||
getMetaMaskIdentities,
|
||||
} from '../../../selectors'
|
||||
import { getMetaMaskIdentities } from '../../../selectors'
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const { request, cachedOrigin, selectedIdentities } = ownProps
|
||||
const targetDomainMetadata = getTargetDomainMetadata(state, request, cachedOrigin)
|
||||
const { selectedIdentities } = ownProps
|
||||
|
||||
const allIdentities = getMetaMaskIdentities(state)
|
||||
const allIdentitiesSelected = Object.keys(selectedIdentities).length === Object.keys(allIdentities).length && selectedIdentities.length > 1
|
||||
|
||||
return {
|
||||
targetDomainMetadata,
|
||||
allIdentitiesSelected,
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,6 @@ export default class PermissionConnect extends Component {
|
||||
const {
|
||||
selectedAccountAddresses,
|
||||
permissionsApproved,
|
||||
origin,
|
||||
redirecting,
|
||||
targetDomainMetadata,
|
||||
} = this.state
|
||||
@ -257,7 +256,7 @@ export default class PermissionConnect extends Component {
|
||||
}}
|
||||
rejectPermissionsRequest={(requestId) => this.cancelPermissionsRequest(requestId)}
|
||||
selectedIdentities={accounts.filter((account) => selectedAccountAddresses.has(account.address))}
|
||||
cachedOrigin={origin}
|
||||
targetDomainMetadata={targetDomainMetadata}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
getNativeCurrency,
|
||||
getAccountsWithLabels,
|
||||
getLastConnectedInfo,
|
||||
getTargetDomainMetadata,
|
||||
getDomainMetadata,
|
||||
getSelectedAddress,
|
||||
} from '../../selectors'
|
||||
|
||||
@ -42,6 +42,15 @@ const mapStateToProps = (state, ownProps) => {
|
||||
const { origin } = metadata
|
||||
const nativeCurrency = getNativeCurrency(state)
|
||||
|
||||
const domainMetadata = getDomainMetadata(state)
|
||||
const targetDomainMetadata = origin
|
||||
? domainMetadata[origin] || {
|
||||
origin,
|
||||
name: (new URL(origin)).hostname,
|
||||
icon: null,
|
||||
}
|
||||
: null
|
||||
|
||||
const accountsWithLabels = getAccountsWithLabels(state)
|
||||
|
||||
const lastConnectedInfo = getLastConnectedInfo(state) || {}
|
||||
@ -63,8 +72,6 @@ const mapStateToProps = (state, ownProps) => {
|
||||
throw new Error('Incorrect path for permissions-connect component')
|
||||
}
|
||||
|
||||
const targetDomainMetadata = getTargetDomainMetadata(state, permissionsRequest, origin)
|
||||
|
||||
return {
|
||||
permissionsRequest,
|
||||
permissionsRequestId,
|
||||
|
@ -287,23 +287,6 @@ export function getDomainMetadata (state) {
|
||||
return state.metamask.domainMetadata
|
||||
}
|
||||
|
||||
export function getTargetDomainMetadata (state, request, defaultOrigin) {
|
||||
const domainMetadata = getDomainMetadata(state)
|
||||
|
||||
const { metadata: requestMetadata = {} } = request || {}
|
||||
const origin = requestMetadata.origin || defaultOrigin
|
||||
|
||||
if (!origin) {
|
||||
return null
|
||||
}
|
||||
|
||||
const hostname = (new URL(origin).hostname)
|
||||
const targetDomainMetadata = (domainMetadata[origin] || { name: hostname, icon: null })
|
||||
targetDomainMetadata.origin = origin
|
||||
|
||||
return targetDomainMetadata
|
||||
}
|
||||
|
||||
export const getBackgroundMetaMetricState = (state) => {
|
||||
return {
|
||||
network: getCurrentNetworkId(state),
|
||||
|
Loading…
Reference in New Issue
Block a user