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: Accept invite by email subscription only #1190

Merged
merged 2 commits into from
Dec 3, 2015

Conversation

roccotripaldi
Copy link
Member

closes #668

This PR adds a footer link to the logged out invite accept, allowing an invited user to follow a blog by email subscription only.

To Test

  1. Invite a non-wpcom email address to follow your blog
  2. log out of wordpress
  3. go to /accept-invite/$blog/$inviteKey/$activation_key/$management_key
  4. click the link at the bottom reading 'Or follow by email subscription only.'
  5. Ensure that you are now following the blog and are redirected to subscribe.wordpress.com

cc: @lezama @ebinnion

@roccotripaldi roccotripaldi added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. People Management labels Dec 2, 2015
@roccotripaldi roccotripaldi self-assigned this Dec 2, 2015
@roccotripaldi roccotripaldi added this to the People Management: m6 milestone Dec 2, 2015
@roccotripaldi roccotripaldi force-pushed the accept-invite-email-only branch 2 times, most recently from 585599a to 1498536 Compare December 2, 2015 17:04
@roccotripaldi
Copy link
Member Author

Note: we'll need to add the subscriptionActivationKey to all follower requests. but that can be handled in another PR.

@@ -6,11 +6,12 @@ import page from 'page';
/**
* Internal dependencies
*/
import { acceptInvite } from './controller';
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I find it more beautiful ☺️ if we do { acceptInvite, saveSubscriptionActivationKey } instead of importing controller

@lezama
Copy link
Contributor

lezama commented Dec 2, 2015

This is looking good :)

@lezama lezama added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Dec 2, 2015
@roccotripaldi
Copy link
Member Author

@lezama thanks for the review. I've address all your feedback. I'm going to look into changing the redirect, and try to do it in this PR.

To clarify, we should redirect to subscribe.wordpress.com/?update=activated&email=$email&key=$key
with YET ANOTHER key.

I think it may be possible to return the latest key on the API after the subscription is activate.

@roccotripaldi roccotripaldi added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Author Reply labels Dec 2, 2015
@roccotripaldi
Copy link
Member Author

I changed my mind. In keeping more with the current way we do things, I decided to add the 3rd key to the URL. so now we'll have
/accept-invite/$site/$invite_key/$activation_key/$management_key for follower invites.

All other invites will only have $invite_key

@@ -10,14 +10,19 @@ import i18n from 'lib/mixins/i18n';
import titleActions from 'lib/screen-title/actions';
import InviteAccept from 'my-sites/invites/invite-accept';

export function acceptInvite( context ) {
titleActions.setTitle( i18n.translate( 'Accept Invite', { textOnly: true } ) );
export default {
Copy link
Contributor

Choose a reason for hiding this comment

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

this could be export function acceptInvite(

@roccotripaldi roccotripaldi force-pushed the accept-invite-email-only branch 2 times, most recently from cd45a52 to 34261a9 Compare December 3, 2015 17:26
@roccotripaldi
Copy link
Member Author

@lezama - i did an other iteration taking your feedback into account.

For now, because of API limitations, I'm keeping all 3 keys in the URL

In another PR, we can clean up the URL by perhaps doing something like the signup flow is using,
where it accepts URL GET parameters, adds them to the component, and then makes the URL look pretty by striping out the parameters.

@ebinnion
Copy link
Contributor

ebinnion commented Dec 3, 2015

Perhaps i'm misunderstand, but an API limitation doesn't necessarily impact whether we do /accept-invite/$site/$invite_key/$activation/$management or /accept-invite/$site/$invite_key?activation=$activation&management=$management. We just need to pass the correct data to the API.

I'm fine with either approach, just wanted to point that out.After re-reading the above comment and realizing that we'll pass three keys, I think I prefer GET parameters and then removing the parameters. If this is functional, we can follow up with that in another PR with a low priority though.

React.createElement( InviteAccept, context.params ),
React.createElement(
InviteAccept,
context.params
Copy link
Contributor

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 the GET parameters above (See what I did there 😛 👓 ) and then we would do the page.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.

Object.assign( invite.invite, {
activationKey: this.props.activation_key,
authKey: this.props.auth_key
} );
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering if you had changed the endpoint to add the activationKey. But, now I see where you added it 😄

@ebinnion
Copy link
Contributor

ebinnion commented Dec 3, 2015

Functionally, this seemed to work well. The only issue I noticed is that after clicking the "Follow by email subscription only" link, there was a lag of a second or two before I was redirected without the UI updating.

Perhaps, we could do something similar to #1237 and disable the form once that link is clicked?

- Render a footer link to accept a follower invite
by email subscription only.

- modifying the route to accept a subscription activation key
and a subscription auth key via url context

- Updating wpcom undocumented to add an activation
to the request so that we can accept follower invites by email only.

- redirect user to subscribe.wordpress.com with their auth key
so they can view / manage their subscription
@roccotripaldi roccotripaldi force-pushed the accept-invite-email-only branch from 34261a9 to 57ae744 Compare December 3, 2015 19:19
@roccotripaldi
Copy link
Member Author

Thanks for the review Eric. I addressed all your feedback.

I was already doing setState( { submitting: true} ); when we clicked the email only link, but the big blue buttons wasn't been disabled. I fixed that here:

https://github.com/Automattic/wp-calypso/pull/1190/files#diff-c1058d9fea1b7d007377a2a1e78a3cccR377

@ebinnion
Copy link
Contributor

ebinnion commented Dec 3, 2015

The disabling looks good to me!

I am getting a JS error after accepting an invite and then going back to /accept-invite/$invite_key/$activation/$manage.

screen shot

My guess is that it's related to this block in refreshInvite(). We should probably wrap that in an:

if ( ! error ) {
  // Do work
}  

@ebinnion ebinnion 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 Dec 3, 2015
roccotripaldi added a commit that referenced this pull request Dec 3, 2015
People: Accept invite by email subscription only
@roccotripaldi roccotripaldi merged commit a7c39bd into master Dec 3, 2015
@lancewillett lancewillett deleted the accept-invite-email-only branch December 22, 2015 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invites: Add ability to "Follow by email subscription only"
4 participants