1
0
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:
Erik Marks 2021-12-13 12:10:20 -08:00 committed by GitHub
parent 69e27c8a82
commit c03b6dd19b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 15 deletions

View File

@ -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"
}
}

View File

@ -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,

View File

@ -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,
});
}

View File

@ -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,

View File

@ -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,
}),
};

View File

@ -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,

View File

@ -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,
};
}
}

View File

@ -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,
}),