Skip to content

Synchronize SAL code as of May 2017.#7142

Merged
dereksmart merged 57 commits intomasterfrom
feature/sync-sal
May 24, 2017
Merged

Synchronize SAL code as of May 2017.#7142
dereksmart merged 57 commits intomasterfrom
feature/sync-sal

Conversation

@zinigor
Copy link
Copy Markdown
Contributor

@zinigor zinigor commented May 8, 2017

cc @gravityrail @ebinnion please take a look at your changes and see if there's something wrong.

Dan Walmsley and others added 30 commits May 8, 2017 12:11
Minimal integration so far, so that we can spread changes out over time...

Merges r132833-wpcom.
As part of our ongoing work to separate rendering of data from core logic,
this patch moves most logic from the posts endpoint into a SAL_Post wrapper class
that can generate the important data for our API.

Merges r133001-wpcom.
In addition, we now pass the token into the SAL instead of just the blog_id and user_id, so
that we can check token scope etc.

Merges r133304-wpcom.
Merges r133305-wpcom.
…d attempt)

In addition, we now pass the token into the SAL instead of just the blog_id and user_id, so
that we can check token scope etc.

First attempt blew up due to missing files which are now checked in.

Merges r133309-wpcom.
…by slug

By not specifying `post_type`, we were limiting slug search to posts. Page lookup by slug may have worked previously by consequence of our page path lookup, but not if trying to find a page by its slug when the page is nested as a child (where path would include parent's slug too).

This behavior includes any whitelisted post type as a candidate for being included in the results of `get_posts`.

See: https://[private link]

Merges r134338-wpcom.
Terms accounts for all public taxonomies, not only categories or tags, as existed previously.

See: https://[private link]

Merges r134355-wpcom.
Summary:
Daily Post (https://[private link]) recently added extra custom post types.

The REST API reports 'unknown_post' if the post type does not match one of the whitelisted ones, currently 'post', 'page', 'revision'.

There was previously a workaround in place for Freshly Pressed to allow it to use CPTs. This patch adds similar support for Daily Post.

Test Plan:
Visit Daily Post feed:

http://[private link]

The majority of posts do not currently load.

Apply the patch and visit the Daily Post feed again. All posts should load correctly, including those with a custom post type.

Reviewers: hbakkalbasi

Reviewed By: hbakkalbasi

Differential Revision: https://[private link]

Merges r135090-wpcom.
props @artpi, who handled development.

Summary:
This is an implementation of instant wordads activation endpoint
It should enable enrolling any business site directly to wordads

Test Plan:
- Create a new empty business site
- Use endpoint
- Verify that site now has wordads

Check that id does not work for any site that does not have business plan, jogged out user, etc.

Reviewers: egille, rralian

Subscribers: derekspringer, scruffian

Differential Revision: https://[private link]

Merges r136724-wpcom.
This is a value that determines if Headstart considers the site to be "fresh" or not, meaning if it has modified content since the last run of Headstart. This can be used t o determine if Headstart could run again. It's not actually a site option (though we'll pretend it is here), but is derived from the blog stickers on the site.

Merges r137127-wpcom.
Closes D2058
Part of T473

Enables sites with business plan to save custom meta title formats for
Front page, Posts, Pages, Categories and Tags, and Archives.
Only allowed chips can be used for defining the custom format.
Additionally, custom formats can only be defined for types listed above.

Here is an example of a valid title format for Post:
"%site_name% | %post_title%"

Props to @vindl for doing the work on this revision

Merges r138148-wpcom.
Add 'podcasting_archive' to the options array in the
get site info endpoint. This contains the post category,
if any, that is used for podcast feed items for
a site.

See also: Automattic/wp-calypso#8109

Code review: https://[private link]

Merges r142507-wpcom.
Add a new option field for Front Page Meta Descripton in order to
support grandfathering for non-business users that have already set
seo_meta_description option.

Merges r143116-wpcom.
Since we now want to offer domains to users without a functional site, we want to allow users with this type of site to purchase a domains with out a plan.

See https://[private link]

Differential revision: D3869

Merges r148702-wpcom.
Introduces Jetpack SEO functions to SAL in order to prepare
for refactoring commit.

Merges r148894-wpcom.
Splitting this out in a separate commit in order to avoid mid-deply fatals.

Ref: https://[private link]

Merges r149785-wpcom.
Summary: Add is_automated_transfer option to identify those sites for extra logic

Test Plan:
Open dev console
Go to /me/sites
Inspect `options`
Response should properly mark sites

Reviewers: lamosty, helpingcat, rralian

Reviewed By: lamosty

Subscribers: aduthie7

Differential Revision: https://[private link]

Merges r150257-wpcom.
Conflicts:
	sal/class.json-api-site-base.php
Merges r136688-wpcom.
Phabricator patch D1933

Merges r136740-wpcom.
also, update checksum to include options

Merges r137290-wpcom.
…on option consistently

The Jetpack Site Icon module was deprecated in 3.6.1. The transition logic deactivates the module for most sites, so the jetpack_site_icon_url function usually does not pass the existence check for most Jetpack sites.

In any case, we plan toward moving to treating Site Icon as the canonical source of site's icon. The changes herein check for this option, falling back to the Jetpack-defined icon option if unset.

This improves consistency between Jetpack shadow sites and the remote site. In my case, /me/sites (shadow site) will show the icon property for my Jetpack site, whereas /sites/%s does not (because the module is not active on the site).

Eventually the goal is to move get_icon to the SAL base site class, dropping Blavatar as a dependency for WordPress.com sites.

Differential Revision: https://[private link]

Merges r148273-wpcom.
@ebinnion
Copy link
Copy Markdown
Contributor

ebinnion commented May 8, 2017

From what I can tell, my only commit was to add remove_users and delete_users capability checks. If that's right, then this LGTM.

@zinigor zinigor added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels May 11, 2017
zinigor added 2 commits May 12, 2017 16:37
Also made sure that the methods are only defined in the final class implementation.
require_once dirname( __FILE__ ) . '/class.json-api-date.php';
require_once dirname( __FILE__ ) . '/class.json-api-post-base.php';

require_once dirname( __FILE__ ) . '/class.json-api-date.php';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we including these twice?

return $wp_version;
}

protected function is_a8c_publication( $post_id ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this should be split into a WPCOM method and Jetpack method, I assume is_post_freshly_pressed and is_dailypost_blog are WPCOM-only methods and you can remove those checks.

in WPCOM_JSON_API_Site_Misc (trait.json-api-site-wpcom.php):

protected function is_a8c_publication( $post_id ) {
  return is_post_freshly_pressed( $post_id ) || is_dailypost_blog( $this->blog_id );
}

In class Jetpack_Site:

protected function is_a8c_publication( $post_id ) {
  return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And don't forget to leave behind:

abstract function is_a8c_publication( $post_id );

so that our subclasses are forced to conform to the interface definition.

@zinigor
Copy link
Copy Markdown
Contributor Author

zinigor commented May 18, 2017

Thanks for taking a look @gravityrail ! I have made the changes, the counterpart is D5525.

Copy link
Copy Markdown
Contributor

@gravityrail gravityrail left a comment

Choose a reason for hiding this comment

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

Looks good!

@zinigor zinigor force-pushed the feature/sync-sal branch from 97887de to 576330c Compare May 24, 2017 08:55
@zinigor
Copy link
Copy Markdown
Contributor Author

zinigor commented May 24, 2017

This is blocking #7026 because the synced code relies on SAL's is_headstart_fresh method. Let's test this once more and get it merged.

To test

  • Check this PR out, enable JSON API on your Jetpack site.
  • Get a tool you're comfortable to test the API, like the WordPress.com console.
  • Test endpoints that hit SAL methods, like sites/%s, sites/%s/posts, sites/%s/posts/%d, etc. Make sure you test all versions of the API endpoint it exists in.
  • Use Calypso with your site and check for any problems, especially with content management - editing, saving, deleting, adding media.
  • Make sure to monitor your site's error logs for errors.

Thank you!

Copy link
Copy Markdown
Contributor

@dereksmart dereksmart left a comment

Choose a reason for hiding this comment

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

Changes look good and it seems to test well.

@dereksmart dereksmart 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 May 24, 2017
@dereksmart dereksmart merged commit 0de7291 into master May 24, 2017
@dereksmart dereksmart deleted the feature/sync-sal branch May 24, 2017 14:36
@dereksmart dereksmart removed the [Status] Ready to Merge Go ahead, you can push that green button! label May 24, 2017
@jeherve jeherve added [Status] Needs Changelog [Status] Needs Testing We need to add this change to the testing call for this month's release and removed [Status] Needs Changelog labels May 25, 2017
jeherve added a commit that referenced this pull request May 29, 2017
eliorivero pushed a commit that referenced this pull request May 30, 2017
* Changelog: first pass at a changelog for 5.0

* Changelog: delete 4.9 testing list.

* Changelog: update minimum WP version to match ver. in jetpack.php

Fixes #7158

* Changelog: add #6051

* Changelog: add #6753

* Changelog: add #6928

* Changelog: add #6964

* Changelog: add #7014

* Changelog: add #7057

* Changelog: add #7060

* Changelog: add #7068

* Changelog: add #7070

* Changelog: add #7072

* Changelog: add #7071

* Changelog: add release date and post shortlink.

* Changelog: add #7094

* Changelog: add #7100

* Changelog: add #7108

* Changelog: add #7113

* Changelog: add #7123

* Changelog: add #7135

* Changelog: add #7143

* Changelog: add #7151

* Changelog: add #6996

* Changelog: add #7105

* Changelog: add #7132

* Changelog: add #7166

* Changelog: fix typo in 4.9 changelog.

* Changelog: remove older releases' changelogs.

@see p1HpG7-42e-p2

* Changelog: add #7090

* Changelog: add #7095

* Changelog: add #7112

* Changelog: add #7115

* Changelog: add #7122

* Changelog: add #7137

* Changelog: add #7138

* Changelog: add #7140

* Changelog: add #7154

* Changelog: add ##7155

* Changelog: add #7163

* Changelog: add #7167

* Changelog: add #7171

* Changelog: add #7180

* Changelog: add #7181

* Changelog: add #7183

* Changelog: add #7184

* Changelog: add #7189

* Changelog: add #7191

* Changelog: add #7193

* Changelog: add #7198

* Changelog: add #7200

* Changelog: add #7209

* Changelog: add #7212

* Testing list: add instructions for #7115

* Changelog: add #7188

* Changelog: add #7205

* Changelog: add #7225

* Changelog: add #6872

* Changelog: add #7107

* Changelog: add #7118

* Changelog: add #7142

* Changelog: add #7170

* Changelog: add #7210

* Changelog: add #7218

* Changelog: add #7232

* Changelog: add #7211

* Changelog: add #7213

* Changelog: add #7229

* Changelog: add #7230

* Changelog: add #7214

* Draft changelog for 5.0

* Changelog updates: 2nd pass at a clearer changelog.

- Fix typos.
- Use consistent tense and tone across all changelog.
- Remove unclear items.

* Changelog: add #7026

* Changelog: add #7058

* Changelog: add #7125

* Changelog: add #7249

* Changelog: add #7185

* add mentions of image widget migration

* Changelog: add info about new output for CLI command.

* Changelog: add WP version number matching the new Image Widget.
@jeherve jeherve removed the [Status] Needs Testing We need to add this change to the testing call for this month's release label Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Epic Formerly "Primary Issue", or "Master Issue" [Package] Sync Touches WP.com Files

Projects

None yet

Development

Successfully merging this pull request may close these issues.