-
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: Invite: Add site to sites-list after accepting invite. #1261
Conversation
7301968
to
c6ca266
Compare
@@ -16,7 +22,15 @@ module.exports = function() { | |||
case 'DELETE_SITE': | |||
_sites.removeSite( action.site ); | |||
break; | |||
|
|||
case InvitesActionTypes.INVITE_ACCEPTED: |
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.
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 👍
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. |
@ebinnion this should be ready for another review :) |
@@ -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 ) ); |
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.
parseInt()
needs the second parameter of 10
in this case.
const site = this.props.sites.getSite( parseInt( siteId, 10 ) );
aa1677c
to
5e85624
Compare
Should be fixed now \o/ |
if ( sites.length === 0 ) { | ||
action.invite.site.primary = true; | ||
} | ||
sites.push( action.invite.site ); |
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.
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?
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.
We are already doing that, _sites.update
calls createSiteObject
on each new site that we pass on sites
@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. |
Fixed in a8d3d2f |
…t-after-accept People: Invite: Add site to sites-list after accepting invite.
Use flux to add the site
How to test
update/invites-add-site-right-after-accept
to check
(I still need to make it work for logged out users)
cc @ebinnion @roccotripaldi