1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 12:56:01 +01:00
metamask-extension/ui/app/pages/provider-approval/provider-approval.component.js
Mark Stacey 99b8f2d544
Fix provider approval metadata (#7349)
* Omit MetaMask `extensionId` from site metadata

The site metadata was updated in #7218 to include the extension id of
the extension connecting to MetaMask. This was done to allow external
extensions to connect with MetaMask, so that we could show the id on
the provider approval screen.

Unbeknownst to me at the time, the extension id was being set for all
connections to MetaMask from dapps. The id was set to MetaMask's id,
because the connections are made through MetaMask's contentscript.

This has been updated to only set the id when accepting a connection
from a different extension.

* Fix `siteMetadata` property names

In #7218 a few things were added to the site metadata, so the provider
approval controller was middleware was updated to accept the site
metadata as an object rather than accepting each property as a separate
parameter. Unfortunately we failed to notice that the site name and
icon were named differently in the site metadata than they were in the
provider approval controller, so the names of those properties were
unintentionally changed in the controller state.

The provider approval controller has been updated to restore the
original property names of `siteTitle` and `siteIcon`. An unused prop
that was added to the provider approval page in #7218 has also been
removed.
2019-11-04 17:28:50 -04:00

37 lines
1.2 KiB
JavaScript

import PropTypes from 'prop-types'
import React, { Component } from 'react'
import ProviderPageContainer from '../../components/app/provider-page-container'
export default class ProviderApproval extends Component {
static propTypes = {
approveProviderRequestByOrigin: PropTypes.func.isRequired,
rejectProviderRequestByOrigin: PropTypes.func.isRequired,
providerRequest: PropTypes.exact({
hostname: PropTypes.string.isRequired,
siteImage: PropTypes.string,
siteTitle: PropTypes.string,
origin: PropTypes.string.isRequired,
extensionId: PropTypes.string,
}).isRequired,
};
static contextTypes = {
t: PropTypes.func,
};
render () {
const { approveProviderRequestByOrigin, providerRequest, rejectProviderRequestByOrigin } = this.props
return (
<ProviderPageContainer
approveProviderRequestByOrigin={approveProviderRequestByOrigin}
rejectProviderRequestByOrigin={rejectProviderRequestByOrigin}
origin={providerRequest.origin}
siteImage={providerRequest.siteImage}
siteTitle={providerRequest.siteTitle}
hostname={providerRequest.hostname}
extensionId={providerRequest.extensionId}
/>
)
}
}