-
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: Invites: Redirect to /posts/%site% #1185
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
*/ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import page from 'page'; | ||
|
||
/** | ||
* Internal dependencies | ||
|
@@ -13,14 +14,22 @@ import Button from 'components/button'; | |
import config from 'config'; | ||
import userModule from 'lib/user'; | ||
import InviteFormHeader from 'my-sites/invites/invite-form-header'; | ||
import { acceptInvite } from 'lib/invites/actions'; | ||
import { acceptInvite, displayInviteAccepted } from 'lib/invites/actions'; | ||
|
||
const user = userModule(); | ||
|
||
export default React.createClass( { | ||
|
||
displayName: 'InviteAcceptLoggedIn', | ||
|
||
acceptInvite() { | ||
const { invite } = this.props; | ||
acceptInvite( invite, () => { | ||
page( this.props.redirectTo ); | ||
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. It doesn't look like we're doing any error handling here. I understand it's probably more edge case to handle errors here (since we validate an invite before showing the user this UI), but it is possible that a user is mobile and lost connection or somehow opened another tab and took an action which invalidated an invite. In this case, we shouldn't redirect the user and tell him/her that it was successful. |
||
displayInviteAccepted( invite.blog_id ); | ||
} ); | ||
}, | ||
|
||
render() { | ||
let userObject = user.get(), | ||
signInLink = config( 'login_url' ) + '?redirect_to=' + encodeURIComponent( window.location.href ); | ||
|
@@ -46,7 +55,7 @@ export default React.createClass( { | |
<Button href={ window.location.origin + '?invite_declined' }> | ||
{ this.translate( 'Decline', { context: 'button' } ) } | ||
</Button> | ||
<Button primary onClick={ () => acceptInvite( this.props.invite ) } href={ this.props.redirectTo } > | ||
<Button primary onClick={ this.acceptInvite }> | ||
{ this.translate( 'Join', { context: 'button' } ) } | ||
</Button> | ||
</div> | ||
|
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.
perhaps change this method name to simply
accept
seeing acceptInvite written so close together feels a little confusing.