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

Site Settings: Use real-time activation state of SEO and Verification modules #11669

Merged
merged 3 commits into from
Mar 2, 2017

Conversation

vindl
Copy link
Member

@vindl vindl commented Mar 1, 2017

This fixes a bug with Jetpack sites where SEO Tools and Site Verification modules can appear as disabled in Calypso if the module has been activated recently, and the sync hasn't completed yet.

To reproduce the bug:

  1. Disable the SEO Tools (Site Verification) module for a Jetpack site with a Professional plan.
  2. Make sure it appears as disabled in /settings/seo/{siteSlug}
  3. Enable the SEO Tools (Site Verification) module in wp-admin/admin.php?page=jetpack#/engagement of your test Jetpack site
  4. Go to /settings/seo/{siteSlug} and see that the module still appears to be inactive.

Testing instructions:

  1. Go to wp-admin/admin.php?page=jetpack#/engagement of your test Jetpack site with a Professional plan.
  2. Make sure that SEO Tools and Site Verification modules are disabled.
  3. Navigate to /settings/seo/{siteSlug} and verify that module disabled notices are shown for these modules.
  4. In wp-admin/admin.php?page=jetpack#/engagement activate SEO Tools and Site Verification modules.
  5. Reload /settings/seo/{siteSlug} and verify that module disabled notices are no longer being shown.
  6. Verify the changes haven't affected WordPress.com sites

@vindl vindl added [Feature] Site Settings All other general site settings. [Type] Bug labels Mar 1, 2017
@vindl vindl added this to the Advanced SEO milestone Mar 1, 2017
@vindl vindl self-assigned this Mar 1, 2017
@matticbot
Copy link
Contributor

@matticbot matticbot added the [Size] S Small sized issue label Mar 1, 2017
@vindl vindl requested review from tyxla, Copons and roundhill March 1, 2017 13:01
@lancewillett lancewillett added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 1, 2017
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

Works as described. I've posted a couple of small suggestions.

Also one thing that bothers me is that if any of those modules are disabled, we're not disabling all of the related fields and buttons. For example, if the SEO Tools module is disabled, we must disable all of the associated fields and buttons in that card. We're doing that for many other Jetpack cards throughout site settings (Subscriptions, Theme Enhancements, Custom Content Types, Publishing Tools).

const jetpackManagementUrl = getSiteOption( state, siteId, 'admin_url' );
const jetpackVersionSupportsSeo = isJetpackMinimumVersion( state, siteId, '4.4-beta1' );
const isAdvancedSeoSupported = site && ( ! site.jetpack || ( site.jetpack && jetpackVersionSupportsSeo ) );

return {
siteId: siteId,
Copy link
Member

Choose a reason for hiding this comment

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

You can use the object literal property value shorthand here, which allows you to change this line to:

siteId,

@@ -437,6 +442,10 @@ export const SeoForm = React.createClass( {
/* eslint-disable react/jsx-no-target-blank */
return (
<div>
{
site.jetpack &&
Copy link
Member

Choose a reason for hiding this comment

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

Let's use the isJetpackSite selector here instead of site.jetpack.

@tyxla tyxla 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, 2017
@matticbot matticbot added [Size] M Medium sized issue and removed [Size] S Small sized issue labels Mar 1, 2017
@vindl
Copy link
Member Author

vindl commented Mar 1, 2017

@tyxla thanks for the suggestions, I've updated the code accordingly.
In addition, the corresponding fields and buttons should now be disabled when module is inactive.

@vindl vindl force-pushed the fix/settings-seo-module-active-state branch from 3e7b41e to 20e36a3 Compare March 1, 2017 18:15
@matticbot matticbot added [Size] M Medium sized issue [Size] L Large sized issue and removed [Size] M Medium sized issue labels Mar 1, 2017
@vindl vindl 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, 2017
@matticbot
Copy link
Contributor

@vindl This PR needs a rebase

@tyxla tyxla modified the milestones: Jetpack Module Settings in Calypso, Advanced SEO Mar 2, 2017
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

The PR needs a rebase, and I've posted a couple of non-blocking nitpicky comments, but it looks good and tests well 👍 Thanks for fixing that 💯

const isDisabled = isSitePrivate || isJetpackUnsupported || isSubmittingForm || isFetchingSettings;
const isSeoDisabled = isDisabled || ( isSeoToolsActive === false );
const isVerificationDisabled = isDisabled || ( isVerificationToolsActive === false );
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need parentheses on these 2 lines?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, it's just something that I've added to make it easier to scan (more readable). Updated.

{ submitButton }
<SectionHeader label={ translate( 'Site Verification Services' ) }>
<Button
compact={ true }
Copy link
Member

Choose a reason for hiding this comment

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

compact={ true } can be shortened to just compact

<Button
compact={ true }
onClick={ this.submitSeoForm }
primary={ true }
Copy link
Member

Choose a reason for hiding this comment

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

primary={ true } can be shortened to just primary

@vindl vindl force-pushed the fix/settings-seo-module-active-state branch from 4b0f6bd to 2c8163c Compare March 2, 2017 15:06
@matticbot matticbot added the [Size] L Large sized issue label Mar 2, 2017
@vindl vindl force-pushed the fix/settings-seo-module-active-state branch from 2c8163c to 8f08773 Compare March 2, 2017 15:08
@matticbot matticbot added the [Size] L Large sized issue label Mar 2, 2017
@vindl vindl force-pushed the fix/settings-seo-module-active-state branch from 8f08773 to 2795f3e Compare March 2, 2017 15:10
@matticbot matticbot added the [Size] L Large sized issue label Mar 2, 2017
@vindl vindl removed [Status] Needs Rebase [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 2, 2017
@vindl vindl merged commit f31abd4 into master Mar 2, 2017
@vindl vindl deleted the fix/settings-seo-module-active-state branch March 2, 2017 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Settings All other general site settings. [Size] L Large sized issue [Type] Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants