Skip to content

Commit

Permalink
Support connected sites for which we have no site metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
danjm committed Dec 2, 2019
1 parent 9b0e6d0 commit f0ef4cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class ConnectedSitesList extends Component {
}
{domainIsExpanded
? <div className="connected-sites-list__domain-origin">
{ domain.extensionId ? t('extensionId', [domain.extensionId]) : domain.key }
{ domain.extensionId ? t('extensionId', [domain.extensionId]) : domain.origin }
</div>
: null
}
Expand Down
12 changes: 7 additions & 5 deletions ui/app/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }
})
}
})
Expand Down Expand Up @@ -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 || {}
Expand All @@ -542,7 +543,8 @@ function getRenderablePermissionsDomains (state) {
: ''

return [ ...acc, {
name,
name: name ? name : domainKey,
origin: name ? domainKey : '',
icon,
key: domainKey,
lastConnectedTime,
Expand Down

0 comments on commit f0ef4cf

Please sign in to comment.