Fix site icon fallback letter (#8815)

The letter chosen for the fallback site icon was being set
inconsistently throughout the extension. The connect flow was using the
first letter of the `origin` for the letter (which was always `H`,
because `HTTP`), but the connect sites list and the account menu were
using the `name` from the domain metadata.

The `name` is now used for the fallback icon everywhere. A selector
that supplied a default domain metadata object has also been augmented
to use the `hostname` rather than the `origin` as a fallback name, to
match the behavior of the inpage provider.
feature/default_network_editable
Mark Stacey 5 years ago committed by GitHub
parent a6ee23cf9a
commit ec10323495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ui/app/components/app/permission-page-container/permission-page-container-content/permission-page-container-content.component.js
  2. 2
      ui/app/pages/permissions-connect/choose-account/choose-account.component.js
  3. 3
      ui/app/selectors/selectors.js

@ -133,7 +133,7 @@ export default class PermissionPageContainerContent extends PureComponent {
<div className="permission-approval-container__content-container"> <div className="permission-approval-container__content-container">
<PermissionsConnectHeader <PermissionsConnectHeader
icon={domainMetadata.icon} icon={domainMetadata.icon}
iconName={domainMetadata.origin} iconName={domainMetadata.name}
headerTitle={title} headerTitle={title}
headerText={ domainMetadata.extensionId headerText={ domainMetadata.extensionId
? t('allowExternalExtensionTo', [domainMetadata.extensionId]) ? t('allowExternalExtensionTo', [domainMetadata.extensionId])

@ -191,7 +191,7 @@ export default class ChooseAccount extends Component {
<div className="permissions-connect-choose-account"> <div className="permissions-connect-choose-account">
<PermissionsConnectHeader <PermissionsConnectHeader
icon={targetDomainMetadata.icon} icon={targetDomainMetadata.icon}
iconName={targetDomainMetadata.origin} iconName={targetDomainMetadata.name}
headerTitle={t('connectWithMetaMask')} headerTitle={t('connectWithMetaMask')}
headerText={accounts.length > 0 headerText={accounts.length > 0
? t('selectAccounts') ? t('selectAccounts')

@ -292,7 +292,8 @@ export function getTargetDomainMetadata (state, request, defaultOrigin) {
const { metadata: requestMetadata = {} } = request || {} const { metadata: requestMetadata = {} } = request || {}
const origin = requestMetadata.origin || defaultOrigin const origin = requestMetadata.origin || defaultOrigin
const targetDomainMetadata = (domainMetadata[origin] || { name: origin, icon: null }) const hostname = (new URL(origin).hostname)
const targetDomainMetadata = (domainMetadata[origin] || { name: hostname, icon: null })
targetDomainMetadata.origin = origin targetDomainMetadata.origin = origin
return targetDomainMetadata return targetDomainMetadata

Loading…
Cancel
Save