mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 11:28:51 +01:00
Subject metadata cleanup (#13090)
This PR fixes some subject metadata-related issues that were missed in #13026.
This commit is contained in:
parent
69e27c8a82
commit
c03b6dd19b
@ -48,9 +48,9 @@ export const currentNetworkTxListSample = {
|
||||
|
||||
export const subjectMetadata = {
|
||||
"https://metamask.github.io": {
|
||||
"origin": "https://metamask.github.io",
|
||||
"name": "E2E Test Dapp",
|
||||
"icon": "https://metamask.github.io/test-dapp/metamask-fox.svg",
|
||||
"lastUpdated": 1620723443380,
|
||||
"host": "metamask.github.io"
|
||||
"iconUrl": "https://metamask.github.io/test-dapp/metamask-fox.svg",
|
||||
"subjectType": "website"
|
||||
}
|
||||
}
|
@ -1175,15 +1175,15 @@ const state = {
|
||||
subjectMetadata: {
|
||||
'https://metamask.github.io': {
|
||||
name: 'E2E Test Dapp',
|
||||
icon: 'https://metamask.github.io/test-dapp/metamask-fox.svg',
|
||||
lastUpdated: 1620723443380,
|
||||
host: 'metamask.github.io',
|
||||
origin: 'https://metamask.github.io',
|
||||
iconUrl: 'https://metamask.github.io/test-dapp/metamask-fox.svg',
|
||||
subjectType: 'website',
|
||||
},
|
||||
'https://app.uniswap.org': {
|
||||
name: 'Uniswap',
|
||||
icon: './UNI.png',
|
||||
lastUpdated: 1620723443380,
|
||||
host: 'app.uniswap.org',
|
||||
origin: 'https://app.uniswap.org',
|
||||
iconUrl: './UNI.png',
|
||||
subjectType: 'website',
|
||||
},
|
||||
},
|
||||
threeBoxSyncingAllowed: false,
|
||||
|
@ -2634,6 +2634,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
subjectType = SUBJECT_TYPES.EXTENSION;
|
||||
this.subjectMetadataController.addSubjectMetadata(origin, {
|
||||
extensionId: sender.id,
|
||||
subjectType: SUBJECT_TYPES.EXTENSION,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,11 @@ import PermissionsConnectPermissionList from '../../permissions-connect-permissi
|
||||
export default class PermissionPageContainerContent extends PureComponent {
|
||||
static propTypes = {
|
||||
subjectMetadata: PropTypes.shape({
|
||||
extensionId: PropTypes.string,
|
||||
iconUrl: PropTypes.string,
|
||||
name: PropTypes.string.isRequired,
|
||||
origin: PropTypes.string.isRequired,
|
||||
subjectType: PropTypes.string.isRequired,
|
||||
extensionId: PropTypes.string,
|
||||
iconUrl: PropTypes.string,
|
||||
}),
|
||||
selectedPermissions: PropTypes.object.isRequired,
|
||||
selectedIdentities: PropTypes.array,
|
||||
|
@ -14,10 +14,11 @@ export default class PermissionPageContainer extends Component {
|
||||
request: PropTypes.object,
|
||||
requestMetadata: PropTypes.object,
|
||||
targetSubjectMetadata: PropTypes.shape({
|
||||
extensionId: PropTypes.string,
|
||||
icon: PropTypes.string,
|
||||
name: PropTypes.string.isRequired,
|
||||
origin: PropTypes.string.isRequired,
|
||||
subjectType: PropTypes.string.isRequired,
|
||||
extensionId: PropTypes.string,
|
||||
iconUrl: PropTypes.string,
|
||||
}),
|
||||
};
|
||||
|
||||
|
@ -21,8 +21,8 @@ export function useOriginMetadata(origin) {
|
||||
if (!origin) {
|
||||
return null;
|
||||
}
|
||||
const url = new URL(origin);
|
||||
|
||||
const url = new URL(origin);
|
||||
const minimumOriginMetadata = {
|
||||
host: url.host,
|
||||
hostname: url.hostname,
|
||||
|
@ -50,9 +50,10 @@ const mapStateToProps = (state, ownProps) => {
|
||||
} else {
|
||||
const targetUrl = new URL(origin);
|
||||
targetSubjectMetadata = {
|
||||
host: targetUrl.host,
|
||||
name: targetUrl.hostname,
|
||||
origin,
|
||||
iconUrl: null,
|
||||
extensionId: null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ PermissionsRedirect.propTypes = {
|
||||
subjectMetadata: PropTypes.shape({
|
||||
extensionId: PropTypes.string,
|
||||
iconUrl: PropTypes.string,
|
||||
subjectType: PropTypes.string,
|
||||
name: PropTypes.string.isRequired,
|
||||
origin: PropTypes.string.isRequired,
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user