Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Janitorial: Refactor Domain Transfer components per code standards #16382

Merged
merged 7 commits into from
Jul 24, 2017

Conversation

aidvu
Copy link
Contributor

@aidvu aidvu commented Jul 19, 2017

Migrate to ES6.

Test:

  • Go to Transfer -> Transfer domain to another registrar
  • Try clicking all of the actions
  • Make sure the UI is not stuck in submitting state
  • Make sure all works as before

@aidvu aidvu self-assigned this Jul 19, 2017
@matticbot
Copy link
Contributor

@matticbot matticbot added the [Size] XL Probably needs to be broken down into multiple smaller issues label Jul 19, 2017
@aidvu aidvu added [Feature Group] Emails & Domains Features related to email integrations and domain management. [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Type] Janitorial and removed [Size] XL Probably needs to be broken down into multiple smaller issues labels Jul 19, 2017
'Privacy Protection has been enabled.' ) );
} else {
notices.success( this.translate( 'We\'ve canceled your domain transfer. Your domain is now locked back.' ) );
notices.success( translate( 'We\'ve canceled your domain transfer. Your domain is now locked back.' ) );
}

if ( this.isMounted() ) {
Copy link
Contributor Author

@aidvu aidvu Jul 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not supported in ES6. Need to figure a way to fix this.

Occurs in locked/unlocked a few times. Chances are the lock is enabled/disabled and the parent component rerenders.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worst case can add a var _isMounted and set it on mount/unmount for now. But I'd rather fix it differently.

https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html

@aidvu aidvu added [Status] In Progress and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jul 19, 2017
@aidvu aidvu force-pushed the update/refactor-transfer-my-sites-domains branch from 0deea5b to 8d079f4 Compare July 20, 2017 12:22
@matticbot matticbot added the [Size] XL Probably needs to be broken down into multiple smaller issues label Jul 20, 2017
@aidvu aidvu added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jul 20, 2017
Copy link
Contributor

@klimeryk klimeryk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the unbound method and that translate call, everything else seems to work A-OK 👍


handleClick() {
handleClick = () => {
this.setState( { submitting: true } );

resendIcannVerification( this.props.selectedDomainName, ( error ) => {
if ( error ) {
notices.error( error.message );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be awesome if you convert the usage of these global, old-style notices to the Redux ones from state/notices/actions (that'd get us a step closer to resolving #3396).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lemme do that in a different PR. I can fix #3396 with it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure 👍 I was postponing fixing that one, because I misunderstood the scope of that issue originally (context: #15880 (comment)). But it should be pretty straightforward if it's just "reduxifying" them.

Copy link
Contributor Author

@aidvu aidvu Jul 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean "just". 😆 ❤️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure that will be a very straightforward and small PR 😏

</Header>
{ this.renderSection() }
</Main>
);
},
}

goToEdit() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be bound to this.

displayRequestTransferCodeResponseNotice( error, getSelectedDomain( this.props ) );
} );
},

handleTransferClick() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, good call.

<div>
<SectionHeader label={ translate( 'Transfer Domain' ) } />
<Card className="transfer-card">
<p>
{ translate(
{ this.props.translate(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should actually stay translate, since it's a stateless component and this.props is probably undefined, but translate is nicely available via the destructured parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, missed this one somehow, eh.

} else if ( hasPrivacyProtection ) {
notices.success( this.translate( 'We\'ve canceled your domain transfer. Your domain is now locked and ' +
notices.success( translate( 'We\'ve canceled your domain transfer. Your domain is now locked and ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above about global notices. If you prefer not to do it in this PR, that's cool, but it's not much more work - just pass the actions to connect and replace the call here.

submitting: false
};
},
class IcannVerification extends React.Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could re-use the new ICANN verification notice from domain management here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally a different PR. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, fair enough ;)

@klimeryk klimeryk added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jul 21, 2017
@aidvu
Copy link
Contributor Author

aidvu commented Jul 21, 2017

@klimeryk thanks! Nice 👀 as always! Will fix those two and merge.

@aidvu aidvu merged commit e8ac97f into master Jul 24, 2017
@aidvu aidvu deleted the update/refactor-transfer-my-sites-domains branch July 24, 2017 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature Group] Emails & Domains Features related to email integrations and domain management. [Size] XL Probably needs to be broken down into multiple smaller issues [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants