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

Google Apps: Show Current User #3584

Merged
merged 12 commits into from
Mar 8, 2016
Merged

Google Apps: Show Current User #3584

merged 12 commits into from
Mar 8, 2016

Conversation

umurkontaci
Copy link
Contributor

Fixes #603.

Requires D1179-code

This changes enables the users to see the current list of Google Apps users per domain and per site.

There quite some changes in this PR, namely I moved the Google Apps store to Redux. Since this component also needs non-Redux data as well, they are glued in the data component.

Screenshots

Sitewide - Has Google Apps

image

Per domain - Has Google Apps

image

Sitewide - No domains

image

Sitewide - Only mapped domains

image

Per domain - Not eligible

image

Testing

  1. Go to domain management -> Email
  2. Ensure they look like the screenshots above and the links work.
  3. Ensure Add button is hidden if you're not an admin
  4. Go to domain management -> Select domain -> Click Email
  5. Ensure they look like the screenshots above and the links work

/cc: @klimeryk @stephanethomas @mtias for code review (first attempt at Redux – extra eyes welcome)
/cc: @breezyskies for design
/cc: @ranh for copy

@umurkontaci umurkontaci added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR G Suite labels Feb 26, 2016
@umurkontaci umurkontaci self-assigned this Feb 26, 2016
@umurkontaci umurkontaci added [Status] In Progress [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] In Progress labels Feb 26, 2016
};

Undocumented.prototype.googleAppsFilterBySiteId = function( siteId, fn ) {
debug( '/sites/:siteId/google-apps/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 should be /sites/:siteId/google-apps (without /site at the end).
Stupid nitpick, but someone might get confused by this print and search for a non-existing endpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@klimeryk
Copy link
Contributor

klimeryk commented Mar 1, 2016

I've encountered an error in weird place - when navigating away from the Email view.
Steps to reproduce:

  1. Visit the Email view: /domains/manage/email/example.com

  2. Try to navigate to your profile (/me) by clicking your profile picture in the upper right corner

  3. You'll get this error in the console:

    Failed propType: Required prop domains was not specified in Email. Check the render method of StoreConnection.

    And then periodically:
    TypeError: Cannot read property 'hasLoadedFromServer' of undefined in index.jsx:110

@klimeryk klimeryk 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 Mar 1, 2016
@umurkontaci umurkontaci force-pushed the update/603-current-gapps branch from 5ed15a6 to 445f9d4 Compare March 1, 2016 23:16
@umurkontaci
Copy link
Contributor Author

I've encountered an error in weird place - when navigating away from the Email view.

Weird bug indeed. During a navigation we unset the selected site before unmounting the component and this led to passing undefined for domains prop. Fixed it by sending an empty object as default.

@umurkontaci
Copy link
Contributor Author

@klimeryk @gwwar Thanks for the review! I've addressed all the concerned mentioned above. I made them into separate commit to let you keep track of what happened since; but before merging I'll rebase the commits – no worries on that part.

@umurkontaci umurkontaci 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 Mar 1, 2016
background: url('/calypso/images/upgrades/google-apps-logo.png');
background-position: left center;
background-repeat: no-repeat;
//noinspection CssUnknownTarget
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like a weird comment creeped in ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It stops Webstorm from complaining about unknown target. But I guess we're not using anything to supress Webstorm errors and it might be best to remove it actually

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@klimeryk
Copy link
Contributor

klimeryk commented Mar 2, 2016

Thanks, @umurkontaci - the issue I've reported has indeed been fixed 👍
I'll let @gwwar comment on the redux improvements :)

I've tested the "no domains" situation:

Per domain - Not eligible
There shouldn't be direct links to this page

I actually do see an Email link which leads to this view for my mapped domain :
2016-03-02-021413_1310x723_scrot
Is this correct? I mean, I think it's a good idea to show the user some information on why he can't add email to his domain right now. But you mentioned "There shouldn't be direct links to this page" so I'm double checking :)

Sitewide - No domains

This scenario shows a "You don't have any domains yet." screen when I do have a domain, it's just a mapped domain. This wording could lead to some confusion - maybe we could show a more informative message when the user has domains, but none of them are eligible?

@ranh
Copy link
Contributor

ranh commented Mar 3, 2016

@umurkontaci I would change the notice for mapped domains slightly:

Google Apps is not supported on this domain
Only domains registered with WordPress.com are eligible for Google Apps.

@umurkontaci umurkontaci force-pushed the update/603-current-gapps branch from 445f9d4 to a10deea Compare March 4, 2016 18:27
@aduth
Copy link
Contributor

aduth commented Mar 7, 2016

I did notice there were 0 tests for this subtree. If you can spare a moment, please rebase from master to pick up #3773 that lets us use a single test runner for client/state and add tests for basic cases.

+1 to tests from me as well. Would appreciate some function docs too. Nice-to-haves, but go a long way to help others looking over the code.

@umurkontaci umurkontaci force-pushed the update/603-current-gapps branch 2 times, most recently from cf00a31 to 56ece0b Compare March 7, 2016 21:25
@umurkontaci
Copy link
Contributor Author

+1 to tests from me as well. Would appreciate some function docs too. Nice-to-haves, but go a long way to help others looking over the code.

Thanks for the review!

@gwwar and @aduth Added some tests and docs and addressed all the things above!

} );

it( 'should not have duplicate items', () => {
const state = items( [ { email: '[email protected]' } ],
Copy link
Contributor

Choose a reason for hiding this comment

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

With the reducer tests, we also like to use deepFreeze to make sure we don't accidentally mutate current state. Usage looks a bit like:

import deepFreeze from 'deep-freeze';
const originalState = deepFreeze( [ { email: '[email protected]' } ] );
const state = items( originalState, ...

@gwwar
Copy link
Contributor

gwwar commented Mar 7, 2016

👍 Thanks for adding tests! ⭐ This redux subtree is good to 🚢 after adding deepFreeze to the reducer tests.

@umurkontaci umurkontaci force-pushed the update/603-current-gapps branch from 56ece0b to 5cb59e4 Compare March 8, 2016 03:51
@umurkontaci
Copy link
Contributor Author

@gwwar Thank you for the review! Added deepFreeze and rebased the commits. Waiting for a final green light :)

@gwwar
Copy link
Contributor

gwwar commented Mar 8, 2016

👍 Redux changes are good to 🚢 I ran into some trouble testing the full flow due to my domain missing WWD info atm, but if @klimeryk has already verified behavior I'm fine with that. Looks like you'll want to rebase, before :shipit:

@umurkontaci umurkontaci force-pushed the update/603-current-gapps branch from 5cb59e4 to 492692a Compare March 8, 2016 16:53
@klimeryk
Copy link
Contributor

klimeryk commented Mar 8, 2016

Tested again, after the rebase and resolving conflicts - looks A-OK.
:shipit:

@klimeryk klimeryk added [Status] Ready to Merge and removed [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 8, 2016
umurkontaci added a commit that referenced this pull request Mar 8, 2016
@umurkontaci umurkontaci merged commit f6aa008 into master Mar 8, 2016
@umurkontaci umurkontaci deleted the update/603-current-gapps branch March 8, 2016 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants