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

Merge API code from wpcom & Moved endpoint instantiations to files that declare their classes. #7700

Merged
merged 28 commits into from
Aug 29, 2017

Conversation

zinigor
Copy link
Member

@zinigor zinigor commented Aug 28, 2017

This merges changes as of August 28th, 2017.

I'm tagging authors for a review, please comment if you feel like something is wrong, missing or shouldn't be included here.


Also in this PR are changes from #7710

marekhrabe and others added 20 commits August 28, 2017 08:31
…un previous tests on new version

Merges r156796-wpcom.
r157700-wpcom allowed the site endpoint to pre-emptively ignore fields and options passed. This teaches the API to pass along the options value if it is supplied. Fields are special, and specified on the root endpoint class.

Merges r157706-wpcom.
Summary:
During our meetup we introduced endpoints for scheduling publicize acitons.
Since we ditnt have any data structures at this point, the architecture was in flux.
In https://[private link] @sirbrillig introduced v2 API endpoints.
This is a cleanup of these endpoints.

Test Plan:
- Test API still works (load calypso, etc)
- Test republicize still works ( on a business site go to posts list,  click sharing under a post and share it to twitter. Go to your twitter page and see that post )

Reviewers: sirbrillig, lamosty, artpi, retrofox

Reviewed By: sirbrillig, retrofox

Subscribers: sirbrillig

Differential Revision: https://[private link]

Merges r157868-wpcom.
See: https://[private link]

Merges r158940-wpcom.
Stops requiring Net Neutrality plugin as mu-plugin and removes API changes. Next step is to remove the actual plugin. Two-step process to minimize chances of errors.

Merges r159248-wpcom.
Summary:
This diff introduces a new bulk post deletion endpoint. The endpoint will be used in the future to enable bulk deletion of posts via Calypso. The endpoint follows the behavior of the current single-delete endpoint: if trash is enabled, the first call will send a post to the trash, and subsequent calls will permanently delete a post. If trash isn't enabled, any call will permanently delete a post.

Trello card: https://trello.com/c/P55zEhRd

Test Plan:
```
cd ~/public_html/bin/tests/api-v1/ && phpunit suites/Post/BulkDeletePostTest.php
```

To test manually, apply the diff, sandbox `[private link]` and make requests using the [api console](https://[private link]) or some other tool against your sandboxed api.

Reviewers: #tanooki, mattormeeple

Reviewed By: #tanooki, mattormeeple

Subscribers: mattormeeple

Differential Revision: https://[private link]

Merges r160522-wpcom.
Splitting out the include of recently added endpoint file to avoid
mid-deploy fatals.

Differential Revision: https://[private link]

Merges r160898-wpcom.
Conflicts:
	json-endpoints.php
…oint

Summary:
In order to add the `posts_per_page` to Calypso, this Diff adds the ability to get/set the setting from the REST endpoint.

[Trello card](https://trello.com/c/dZQHF7vE)

Test Plan:
* Make sure tests pass:

```
cd ~/public_html/bin/tests/api-v1 && phpunit suites/Site/SiteSettingsTest.php
```

* Sandbox public-api
* Retrieve settings for one of your sites: https://[private link].1/sites/[private link]
* Make sure the response contains `posts_per_page` and the setting matches the setting for your site
* Post to the same endpoint and update the setting (by posting the key `posts_per_page` with any integer value)
* Make sure the value is properly updated

Reviewers: #tanooki, mattormeeple

Reviewed By: #tanooki, mattormeeple

Subscribers: mattormeeple

Differential Revision: https://[private link]

Merges r155891-wpcom.
…rom Jetpack.

Summary:
This merges the following commits:
    - a698e2f
    - 259c1d8
    - 52f2d87
    - a8de343
    - 7c24905
    - b37cd69
    - 348017e
    - 67e3bce
    - a5f1be0
    - ebe937a
    - 26dbd2a
    - cfc5267
    - 436a3ea

Test Plan: This diff was created automatically with no test plan.

Reviewers: aduthie7, vindl

Reviewed By: vindl

Subscribers: zinigor, eliorivero

Maniphest Tasks: T511

Differential Revision: https://[private link]

Merges r156010-wpcom.
See: https://[private link]

Merges r158940-wpcom.
…ifferent format when saved than when retrieved

Merges r159009-wpcom.
Stops requiring Net Neutrality plugin as mu-plugin and removes API changes. Next step is to remove the actual plugin. Two-step process to minimize chances of errors.

Merges r159248-wpcom.
See Automattic/wp-calypso#69

The REST API settings endpoint includes a property `jetpack_relatedposts_enabled`, which is true if the Related Posts plugin will display related posts. The value from this endpoint is incorrect, however, when a site has not modified their settings. This is because the `Jetpack_RelatedPosts` plugin defaults the setting to be enabled if it is not set.

This change modifies the endpoint to use the same logic: if the setting is not set, it will default to reporting `jetpack_relatedposts_enabled` as true.

Some sites (VIP and Jetpack) default this setting to `false` instead, but the way this is accomplished is that when the plugin is loaded by `wp-content/mu-plugins/related-posts.php`, it actively changes the option to `false`. Since that loader should still be used by the REST API, that should mean that such sites will continue to have `jetpack_relatedposts_enabled` reported correctly.

Merges r159322-wpcom.
Conflicts:
	json-endpoints/class.wpcom-json-api-site-settings-endpoint.php
Summary: During testing of the new Media Video Widget, the videopress_guid which is needed to construct the proper oembed url was missing in API responses for me.  The following minor change fixes this issue.  Additional details #7215

Test Plan: See the PR linked above for test instructions

Reviewers: codebykat

Reviewed By: codebykat

Subscribers: dbtlr

Differential Revision: https://[private link]

Merges r156992-wpcom.
…that was due to merging in WPCOM only code. This adds in a WPCOM exclusion to remove videopress processing.

Merges r158493-wpcom.
…etpack requests. This attempts to normalize how media items are accessed and how add a couple of failure exceptions to help recover if they are encountered.

Merges r159298-wpcom.
Conflicts:
	json-endpoints/class.wpcom-json-api-upload-media-v1-1-endpoint.php
zinigor and others added 2 commits August 28, 2017 09:23
Note: This commit only adds the new endpoint file. The remainder of D6769 will follow in a subsequent commit.

Summary:
This diff introduces a new bulk post deletion endpoint. The endpoint will be used in the future to enable bulk deletion of posts via Calypso. The endpoint follows the behavior of the current single-delete endpoint: if trash is enabled, the first call will send a post to the trash, and subsequent calls will permanently delete a post. If trash isn't enabled, any call will permanently delete a post.

Author: @jonathansadowski
Merges r160521-wpcom.
Copy link
Contributor

@dbtlr dbtlr left a comment

Choose a reason for hiding this comment

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

I'm not sure what type of review I can provide. The only file touched that I'm familiar with seems to be a whitespace change... so LGTM?

@ebinnion
Copy link
Contributor

Net neutrality was a short-lived featured, so was added and then removed a few days later. I don't see any mentions of it in this PR, so that part of it LGTM.

Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

I don't fully recall touching the code here, but the upload media endpoint I do recall being modified a bit for the Video Widget work. Seems just like a formatting change there so looks okay to me.

@dereksmart
Copy link
Member

I've tested this with sites running both PHP 7.1.x and 5.6, and ran into no issues when testing as much as I could in Calypso.

It fixes the segfault errors for 7.1.x in my case.

Also, I think the refactor of the API endpoint class instantiations makes sense from an organization and readability standpoint.

@dereksmart dereksmart changed the title Merge differences between WordPress.com API code and Jetpack. Merge API code from wpcom & Moved endpoint instantiations to files that declare their classes. Aug 29, 2017
@dereksmart dereksmart added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] In Progress labels Aug 29, 2017
@samhotchkiss samhotchkiss merged commit f409654 into master Aug 29, 2017
@dereksmart dereksmart deleted the merge/json-endpoints/082017 branch August 29, 2017 20:15
@kraftbj kraftbj removed the [Status] Ready to Merge Go ahead, you can push that green button! label Oct 13, 2020
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.