From 0e13d39361b770369e4df5a43b5defa570af7fc4 Mon Sep 17 00:00:00 2001 From: Miguel Lezama Date: Tue, 24 Nov 2015 09:47:19 -0300 Subject: [PATCH 1/2] Invites: Use loadash get --- client/accept-invite/logged-out-invite/signup-form.jsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/client/accept-invite/logged-out-invite/signup-form.jsx b/client/accept-invite/logged-out-invite/signup-form.jsx index 477598fe1c9962..673ddd4eb08ef5 100644 --- a/client/accept-invite/logged-out-invite/signup-form.jsx +++ b/client/accept-invite/logged-out-invite/signup-form.jsx @@ -2,6 +2,7 @@ * External dependencies */ import React from 'react' +import { get } from 'lodash' /** * Internal dependencies @@ -42,11 +43,6 @@ export default React.createClass( { ); }, - getInviteRole() { - let meta = this.props.invite && this.props.invite.meta ? this.props.invite.meta : false; - return meta && meta.role ? meta.role : false; - }, - getFormHeader() { return ( @@ -65,7 +61,7 @@ export default React.createClass( { this.translate( 'As an %(siteRole)s you will be able to publish and edit your own posts as well as upload media.', { args: { - siteRole: this.getInviteRole() + siteRole: get( this.props, 'invite.meta.role' ) } } ) From 7ca0620b8ebff1a59255f431e50a6c1ae5c692be Mon Sep 17 00:00:00 2001 From: Miguel Lezama Date: Tue, 24 Nov 2015 09:47:43 -0300 Subject: [PATCH 2/2] Invites: Pre-populate email value --- client/accept-invite/logged-out-invite/signup-form.jsx | 1 + client/components/signup-form/index.jsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/accept-invite/logged-out-invite/signup-form.jsx b/client/accept-invite/logged-out-invite/signup-form.jsx index 673ddd4eb08ef5..39ec649f6e484d 100644 --- a/client/accept-invite/logged-out-invite/signup-form.jsx +++ b/client/accept-invite/logged-out-invite/signup-form.jsx @@ -115,6 +115,7 @@ export default React.createClass( { submitForm={ this.submitForm } submitButtonText={ this.submitButtonText() } footerLink={ this.footerLink() } + email={ get( this.props, 'invite.meta.sent_to' ) } /> { this.state.userData && this.loginUser() } diff --git a/client/components/signup-form/index.jsx b/client/components/signup-form/index.jsx index bbb5ffdc1f99a0..1da20075094eef 100644 --- a/client/components/signup-form/index.jsx +++ b/client/components/signup-form/index.jsx @@ -266,7 +266,7 @@ export default React.createClass( { id="email" name="email" type="email" - value={ formState.getFieldValue( this.state.form, 'email' ) } + value={ formState.getFieldValue( this.state.form, 'email' ) || this.props.email } isError={ formState.isFieldInvalid( this.state.form, 'email' ) } isValid={ formState.isFieldValid( this.state.form, 'email' ) } onBlur={ this.handleBlur }