From f0ef4cfa05992da22f79c2a6f234551c21564734 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Mon, 2 Dec 2019 10:37:55 -0330 Subject: [PATCH] Support connected sites for which we have no site metadata. --- .../connected-sites-list.component.js | 2 +- ui/app/selectors/selectors.js | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/app/components/app/connected-sites-list/connected-sites-list.component.js b/ui/app/components/app/connected-sites-list/connected-sites-list.component.js index 1bde4855f7ba..daf45c74fb73 100644 --- a/ui/app/components/app/connected-sites-list/connected-sites-list.component.js +++ b/ui/app/components/app/connected-sites-list/connected-sites-list.component.js @@ -89,7 +89,7 @@ export default class ConnectedSitesList extends Component { } {domainIsExpanded ?
- { domain.extensionId ? t('extensionId', [domain.extensionId]) : domain.key } + { domain.extensionId ? t('extensionId', [domain.extensionId]) : domain.origin }
: null } diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index 206d27a62cb4..20a667afec01 100644 --- a/ui/app/selectors/selectors.js +++ b/ui/app/selectors/selectors.js @@ -459,15 +459,16 @@ function getAddressConnectedDomainMap (state) { if (domains) { Object.keys(domains).forEach(domainKey => { const { permissions } = domains[domainKey] - const { icon, name } = domainMetadata[domainKey] + const { icon, name } = domainMetadata[domainKey] || {} permissions.forEach(perm => { const caveats = perm.caveats || [] const exposedAccountCaveat = caveats.find(caveat => caveat.name === 'exposedAccounts') if (exposedAccountCaveat && exposedAccountCaveat.value && exposedAccountCaveat.value.length) { exposedAccountCaveat.value.forEach(address => { + const nameToRender = name ? name : domainKey addressConnectedIconMap[address] = addressConnectedIconMap[address] - ? { ...addressConnectedIconMap[address], [domainKey]: { icon, name } } - : { [domainKey]: { icon, name } } + ? { ...addressConnectedIconMap[address], [domainKey]: { icon, name: nameToRender } } + : { [domainKey]: { icon, name: nameToRender } } }) } }) @@ -531,7 +532,7 @@ function getRenderablePermissionsDomains (state) { name, icon, extensionId, - } = domainMetadata[domainKey] + } = domainMetadata[domainKey] || {} const permissionsHistoryForDomain = permissionsHistory[domainKey] || {} const ethAccountsPermissionsForDomain = permissionsHistoryForDomain['eth_accounts'] || {} const accountsLastConnectedTime = ethAccountsPermissionsForDomain.accounts || {} @@ -542,7 +543,8 @@ function getRenderablePermissionsDomains (state) { : '' return [ ...acc, { - name, + name: name ? name : domainKey, + origin: name ? domainKey : '', icon, key: domainKey, lastConnectedTime,