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

People: Invites: Pre populate email field #623

Merged
merged 2 commits into from
Nov 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions client/accept-invite/logged-out-invite/signup-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
import React from 'react'
import { get } from 'lodash'

/**
* Internal dependencies
Expand Down Expand Up @@ -42,19 +43,14 @@ 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 (
<InviteFormHeader
title={
this.translate( 'Sign up to become an %(siteRole)s on {{siteNameLink}}%(siteName)s{{/siteNameLink}}?', {
args: {
siteName: this.props.blog_details.title,
siteRole: this.getInviteRole()
siteRole: get( this.props, 'invite.meta.role' )
},
components: {
siteNameLink: <a href={ this.props.blog_details.domain } className="logged-in-accept__site-name" />
Expand All @@ -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' )
}
}
)
Expand Down Expand Up @@ -119,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() }
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/components/signup-form/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down