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: Invite: Add site to sites-list after accepting invite. #1261

Merged
merged 11 commits into from
Dec 10, 2015

Conversation

lezama
Copy link
Contributor

@lezama lezama commented Dec 4, 2015

Use flux to add the site

How to test

  • checkout update/invites-add-site-right-after-accept

to check

  • both flows logged in and logged out flows should still work
  • after accepting an invite you should be redirected to the site/post list

(I still need to make it work for logged out users)

cc @ebinnion @roccotripaldi

@lezama lezama added this to the People Management: m6 milestone Dec 4, 2015
@lezama lezama self-assigned this Dec 4, 2015
@lezama lezama force-pushed the update/invites-add-site-right-after-accept branch from 7301968 to c6ca266 Compare December 4, 2015 19:25
@lezama lezama added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] In Progress and removed [Status] In Progress [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Dec 4, 2015
@@ -16,7 +22,15 @@ module.exports = function() {
case 'DELETE_SITE':
_sites.removeSite( action.site );
break;

case InvitesActionTypes.INVITE_ACCEPTED:
Copy link
Contributor

Choose a reason for hiding this comment

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

I like using flux to handle this. My first thought was to just clear the sites list and re-fetch, but this should be a bit more elegant 👍

@ebinnion
Copy link
Contributor

ebinnion commented Dec 4, 2015

It looks like we're no longer auto-filling the email address:

accept invite no email

Also, when I tried to accept an invite while logged out, I got this error:
screen shot 1

I saw above where you said, I still need to make it work for logged out users. But, just above that, it also says, both flows logged in and logged out flows should still work. So, I wasn't sure if this error is expected.

Lastly, we should probably fix it so the error doesn't occur before merging this PR.

@ebinnion
Copy link
Contributor

ebinnion commented Dec 4, 2015

Also, I got this error when trying to accept an invite while logged in:

screen shot

@lezama
Copy link
Contributor Author

lezama commented Dec 4, 2015

I addressed both last comments, still working on make it work for logged out users. Thanks for the feedback @ebinnion, I will ping you again once everything in place.

@lezama
Copy link
Contributor Author

lezama commented Dec 7, 2015

@ebinnion this should be ready for another review :)

@lezama lezama added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Dec 7, 2015
@@ -30,7 +30,7 @@ export default React.createClass( {
}
const { accepted, declined, siteId } = this.state;
if ( accepted ) {
const site = this.props.sites.getSite( siteId );
const site = this.props.sites.getSite( parseInt( siteId ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

parseInt() needs the second parameter of 10 in this case.

const site = this.props.sites.getSite( parseInt( siteId, 10 ) );

@ebinnion ebinnion 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 7, 2015
@ebinnion
Copy link
Contributor

ebinnion commented Dec 7, 2015

This tests fine for the logged out invite accept flow, but I'm getting an error when trying to accept an invite while logged in.

screen shot 4

@lezama lezama force-pushed the update/invites-add-site-right-after-accept branch from aa1677c to 5e85624 Compare December 9, 2015 15:21
@lezama lezama 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 9, 2015
@lezama
Copy link
Contributor Author

lezama commented Dec 9, 2015

@ebinnion:

I'm getting an error when trying to accept an invite while logged in.

Should be fixed now \o/

@ebinnion
Copy link
Contributor

ebinnion commented Dec 9, 2015

I just tested again, and I'm now actually getting two errors when trying to accept an invite.

screen shot 1

if ( sites.length === 0 ) {
action.invite.site.primary = true;
}
sites.push( action.invite.site );
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we keep having errors that are likely due to us trying to add our idea of a site object into the sites list. We should try to find some way to normalize our data into a site object. Perhaps we should try creating a proper site object using lib/site?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are already doing that, _sites.update calls createSiteObject on each new site that we pass on sites

@ebinnion
Copy link
Contributor

ebinnion commented Dec 9, 2015

@lezama and I did a screenhero session and I was not able to repro the errors that I mentioned in the last comment. I pointed out an issue where I could no longer dismiss notices. Other than that, functionally, this seems to work well.

@lezama
Copy link
Contributor Author

lezama commented Dec 10, 2015

I pointed out an issue where I could no longer dismiss notices

Fixed in a8d3d2f

lezama added a commit that referenced this pull request Dec 10, 2015
…t-after-accept

People: Invite: Add site to sites-list after accepting invite.
@lezama lezama merged commit eea4616 into master Dec 10, 2015
@scruffian scruffian removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 10, 2015
@lezama lezama deleted the update/invites-add-site-right-after-accept branch December 10, 2015 12:08
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.

3 participants