Skip to content

Commit

Permalink
Fix migration error (#253) (#254)
Browse files Browse the repository at this point in the history
* Add legacy registrant
* Only allow DeedOwner to transfer
  • Loading branch information
makoto authored May 3, 2019
1 parent b878f7b commit 3b4efc8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
38 changes: 37 additions & 1 deletion src/components/SingleName/NameDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import DetailsItemEditable from './DetailsItemEditable'
import AddRecord from './AddRecord'
import SetupName from '../SetupName/SetupName'
import TransferRegistrars from './TransferRegistrars'
import { SingleNameBlockies } from './SingleNameBlockies'
import DefaultEtherScanLink from '../ExternalLinks/EtherScanLink'

import {
SET_OWNER,
Expand Down Expand Up @@ -43,6 +45,11 @@ const ExpirationDetailsValue = styled(DetailsValue)`
color: ${p => (p.isExpired ? 'red' : null)};
`

const EtherScanLink = styled(DefaultEtherScanLink)`
display: flex;
align-items: center;
`

function canClaim(domain) {
if (!domain.name.match(/\.test$/)) return false
return parseInt(domain.owner) === 0 || domain.expiryTime < new Date()
Expand Down Expand Up @@ -86,7 +93,7 @@ function hasAnyRecord(domain) {
}
}

function NameDetails({ domain, isOwner, refetch, account, registrationOpen }) {
function NameDetails({ domain, isOwner, refetch, account }) {
const isDeedOwner = domain.deedOwner === account
const isRegistrant = domain.registrant === account
const isPermanentRegistrarDeployed = domain.available !== null
Expand Down Expand Up @@ -180,6 +187,35 @@ function NameDetails({ domain, isOwner, refetch, account, registrationOpen }) {
confirm={true}
/>
</>
) : domain.parent === 'eth' && !domain.isNewRegistrar ? (
<>
<DetailsItem uneditable>
<DetailsKey>Registrant</DetailsKey>
<DetailsValue>
<EtherScanLink address={domain.deedOwner}>
<SingleNameBlockies
address={domain.deedOwner}
imageSize={24}
/>
{domain.deedOwner}
</EtherScanLink>
</DetailsValue>
</DetailsItem>
<DetailsItemEditable
domain={domain}
keyName="Controller"
value={domain.owner}
canEdit={isOwner || isRegistrant}
deedOwner={domain.deedOwner}
isDeedOwner={isDeedOwner}
type="address"
editButton={isRegistrant ? 'Set' : 'Transfer'}
mutationButton={isRegistrant ? 'Set' : 'Transfer'}
mutation={isRegistrant ? RECLAIM : SET_OWNER}
refetch={refetch}
confirm={true}
/>
</>
) : (
<DetailsItemEditable
domain={domain}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SingleName/TransferRegistrars.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function displayMigrationDiralogue({
confirmed
}) {
return (
(parent === 'eth' && ((isOwner || isDeedOwner) && !isNewRegistrar)) ||
(parent === 'eth' && ((isDeedOwner) && !isNewRegistrar)) ||
confirmed
)
}
Expand Down

0 comments on commit 3b4efc8

Please sign in to comment.