Skip to content

REST API: Add support for stats module in JPO endpoints#8875

Merged
tyxla merged 2 commits intomasterfrom
add/jpo-rest-api-stats-module
Feb 20, 2018
Merged

REST API: Add support for stats module in JPO endpoints#8875
tyxla merged 2 commits intomasterfrom
add/jpo-rest-api-stats-module

Conversation

@tyxla
Copy link
Copy Markdown
Member

@tyxla tyxla commented Feb 19, 2018

This PR adds support for enabling stats through JPO - preparatory work for Automattic/wp-calypso#22532.

The PR introduces:

  • A new boolean stats parameter for JPO saving POST endpoint - when enabled, will try to enable the stats module. Requires connection.
  • A new boolean stats field to return in the GET endpoint, which will return true if the stats module is enabled and the site is connected; false in all other cases.

To test:

  • Load local Calypso.
  • Checkout this branch on a fresh Jetpack site.
  • Start the onboarding flow (/wp-admin/admin.php?page=jetpack&action=onboard&calypso_env=development)
  • In your console, enter dispatch( { type: 'JETPACK_ONBOARDING_SETTINGS_REQUEST', siteId: 12345678 } ), where 12345678 is the ID of your site.
  • Verify the response contains a stats field in the onboarding option and it's disabled.
  • In your console, enter dispatch( { type: 'JETPACK_ONBOARDING_SETTINGS_SAVE', siteId: 12345678, settings: { stats: true } } ) , where 12345678 is the ID of your site.
  • Verify you get a stats not connected error.
  • Connect the site.
  • In your console, enter dispatch( { type: 'JETPACK_ONBOARDING_SETTINGS_SAVE', siteId: 12345678, settings: { stats: true } } ) , where 12345678 is the ID of your site.
  • Verify you receive a successful response, and the stats module gets enabled.

Changelog entry

  • We added the ability to enable the stats module when using the Onboarding functionality.

@tyxla tyxla added [Status] Needs Review This PR is ready for review. [Feature] WP REST API labels Feb 19, 2018
@tyxla tyxla self-assigned this Feb 19, 2018
@tyxla tyxla requested review from AnnaMag, ockham and oskosk February 19, 2018 14:06
@tyxla tyxla requested a review from a team as a code owner February 19, 2018 14:06
@tyxla tyxla added this to the 5.9 milestone Feb 19, 2018
Copy link
Copy Markdown
Contributor

@oskosk oskosk left a comment

Choose a reason for hiding this comment

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

Tested exactly as expected according to the testing instructions. :shipit:

@oskosk oskosk added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Feb 19, 2018
Copy link
Copy Markdown
Contributor

@AnnaMag AnnaMag left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@tyxla
Copy link
Copy Markdown
Member Author

tyxla commented Feb 20, 2018

Thank you folks!

@tyxla tyxla merged commit 84883d6 into master Feb 20, 2018
@tyxla tyxla deleted the add/jpo-rest-api-stats-module branch February 20, 2018 10:53
@tyxla tyxla removed the [Status] Ready to Merge Go ahead, you can push that green button! label Feb 20, 2018
oskosk added a commit that referenced this pull request Feb 27, 2018
oskosk added a commit that referenced this pull request Feb 27, 2018
* update changelog.txt

* Update readme.txt with scaffolding for 5.9 changelog and release draft shortlink

* Add changelog entry for #8243

* Add changelog entry for #8296

* Add changelog entry for #8367

* Add changelog entry for #8686

* Add changelog entry for #8707

* Add changelog entry for #8709 and #8714

* Add changelog entry for #8729

* Add changelog entry for #8777

* Add changelog entry for #8780

* Add changelog entry for #8786

* Add changelog entry for #8787

* Add changelog entry for #8801 #8805 #8832 #8865 and #8804

* Add changelog entry for #8817

* Add changelog entry for #8822

* Add changelog entry for #8823

* Add changelog entry for #8829

* Add changelog entry for #8834

* move some items to major enhancements

* Add changelog entry for #8836

* Add changelog entry for #8839

* Add changelog entry for #8861

* Add changelog entry for #8862

* Add changelog entry for #8863

* Add changelog entry for #8866

* Add changelog entry for #8870

* Add changelog entry for #8874

* Add changelog entry for #8875

* Add changelog entry for #8881

* Add changelog entry for #8890

* Add changelog entry for #8911

* Add changelog entry for #8927

* Add changelog entry for #8931

* Add changelog entry for #8933

* Add changelog entry for #8930

* fix wording

* typo

* minor fixes

* replace partner scripts for Jetpack Start in changelog entry

* Update to-test.md

* Update to-test.md

* minor style fixes to to-test.md

* minor style fixes to to-test.md

* minor fixes on to-test.md

* Add changelog entry for #8868

* Add changelog entry for #8844

* Add changelog entry for #8664

* Add changelog entry for #8935

* Add changelog entry for #8425

* Add changelog entry for #8625
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.

4 participants