-
Notifications
You must be signed in to change notification settings - Fork 2k
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: Accept invite by email subscription only #1190
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ export default React.createClass( { | |
); | ||
}, | ||
|
||
getFormHeader() { | ||
renderFormHeader() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice change :) |
||
return ( | ||
<InviteFormHeader { ...this.props } /> | ||
); | ||
|
@@ -60,11 +60,40 @@ export default React.createClass( { | |
) | ||
}, | ||
|
||
footerLink() { | ||
subscribeUserByEmailOnly() { | ||
this.setState( { submitting: true } ); | ||
acceptInvite( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should change what |
||
this.props.invite, | ||
( error ) => { | ||
if ( error ) { | ||
this.setState( { error } ); | ||
} else { | ||
window.location = 'https://subscribe.wordpress.com?update=activate&email=' + encodeURIComponent( this.props.invite.meta.sent_to ) + '&key=' + this.props.invite.authKey; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to send the user to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like that idea! I was just mimicking the current flow. |
||
} | ||
} | ||
); | ||
}, | ||
|
||
renderFooterLink() { | ||
let logInUrl = config( 'login_url' ) + '?redirect_to=' + encodeURIComponent( window.location.href ); | ||
return ( | ||
<a href={ logInUrl } className="logged-out-form__link"> | ||
{ this.translate( 'Already have a WordPress.com account? Log in now.' ) } | ||
<div> | ||
<a href={ logInUrl } className="logged-out-form__link"> | ||
{ this.translate( 'Already have a WordPress.com account? Log in now.' ) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think both links should be in the same translation string in order to give Translators some context. "Or" could be tricky to place/translate. |
||
</a> | ||
{ this.renderEmailOnlySubscriptionLink() } | ||
</div> | ||
); | ||
}, | ||
|
||
renderEmailOnlySubscriptionLink() { | ||
if ( this.props.invite.meta.role !== 'follower' || ! this.props.invite.activationKey ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At first glance, I thought this could prevent a potential issue with But, since we control the invitation email, and since we don't need an activation key for viewers, I don't anticipate this being an issue. |
||
return null; | ||
} | ||
|
||
return ( | ||
<a onClick={ this.subscribeUserByEmailOnly } className="logged-out-form__link"> | ||
{ this.translate( 'Follow by email subscription only.' ) } | ||
</a> | ||
); | ||
}, | ||
|
@@ -75,12 +104,12 @@ export default React.createClass( { | |
<SignupForm | ||
getRedirectToAfterLoginUrl={ this.getRedirectToAfterLoginUrl } | ||
disabled={ this.state.submitting } | ||
formHeader={ this.getFormHeader() } | ||
formHeader={ this.renderFormHeader() } | ||
submitting={ this.state.submitting } | ||
save={ this.save } | ||
submitForm={ this.submitForm } | ||
submitButtonText={ this.submitButtonText() } | ||
footerLink={ this.footerLink() } | ||
footerLink={ this.renderFooterLink() } | ||
email={ get( this.props, 'invite.meta.sent_to' ) } | ||
/> | ||
{ this.state.userData && this.loginUser() } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,6 @@ | |
display: block; | ||
font-size: 12px; | ||
text-align: center; | ||
margin-bottom: 8px; | ||
cursor: pointer; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is that if we moved to using
GET
parameters, the heavy lifting would be done here. In this method we would get theGET
parameters above (See what I did there 😛 👓 ) and then we would do thepage.replace()
or similar.The only other change I think we would need is updating the route in
my-sites/invites/index.js
to be'/accept-invite/:site_id/:invitation_key
.