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: Normalize invite create validations in the reducer #3293

Closed

Conversation

ebinnion
Copy link
Contributor

Previously, successful validations were normalized when updating the state in the invite form component. But, that could be an issue if the data is needed in more than one place.

This PR normalizes the success validations, which can sometimes be return as an object or an array, in the reducer so that components can simply retrieve the data.

To test:

  • Checkout update/people-invite-create-validate-normalizze branch
  • Go to /people/new/$site
  • Attempt to add usernames or email addresses
  • Ensure that nothing is broken :)
  • To test if validation works properly, you can test that tokens get a status by entering localStorage.setItem( 'debug', 'calypso:my-sites:people:invites' ); in the console

cc @lezama for review since he worked on the initial normalization and has a better handle on the issues.

Previously, successful validations were normalized when updating the state in the invite form component. But, that could be an issue if the data is needed in more than one place.

This PR normalizes the success validations, which can sometimes be return as an object or an array, in the reducer so that components can simply retrieve the data.
@ebinnion ebinnion added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. People Management labels Feb 13, 2016
@ebinnion ebinnion self-assigned this Feb 13, 2016
@ebinnion ebinnion added this to the People Management: m7 milestone Feb 13, 2016
@@ -8,6 +8,16 @@ import { fromJS } from 'immutable';
*/
import { action as ActionTypes } from 'lib/invites/constants';

function normalizeSuccessValidations( validations ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could move it to where RECEIVE_CREATE_INVITE_VALIDATION_SUCCESS is dispatched.

@ebinnion
Copy link
Contributor Author

Closing in favor of #3540.

@ebinnion ebinnion closed this Feb 24, 2016
@ebinnion ebinnion deleted the update/people-invite-create-validate-normalizze branch February 24, 2016 19:50
@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 Feb 24, 2016
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