Skip to content

Commit

Permalink
Unlaunched sites: Set a blog option of "unlaunched" to sites that are…
Browse files Browse the repository at this point in the history
… created private (#10560)

* Unlaunched sites: Set a blog option of "unlaunched" to sites that are created private.

This will enable us to distinguish sites that are created private from sites that are deliberately private, so that we can show a coming soon page on them and a pre-launch banner.

This diff does several things:

It sets a blog option of launch-status to unlaunched when users create a site which is private.
It enables users to publish posts and pages to sites which have the launch-status blog option, even if their email address is unverified (this is OK because sites which are  unlaunched aren't public, so there's no spam concerns, and they can't update the status to be launched without verifying their email address)
It returns the launch-status of a site in the API
Moves the functionality into a lib so we can use it in multiple places

Differential Revision: D19586

This commit syncs r182320-wpcom.

* Add the functon to the API base
  • Loading branch information
scruffian authored and dereksmart committed Dec 4, 2018
1 parent 5a3e1da commit 9013fdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion json-endpoints/class.wpcom-json-api-get-site-endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
'jetpack_modules' => '(array) A list of active Jetpack modules.',
'meta' => '(object) Meta data',
'quota' => '(array) An array describing how much space a user has left for uploads',
'launch_status' => '(string) A string describing the launch status of a site',
);

protected static $no_member_fields = array(
Expand All @@ -68,6 +69,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
'is_private',
'is_following',
'meta',
'launch_status',
);

protected static $site_options_format = array(
Expand Down Expand Up @@ -125,7 +127,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
'has_pending_automated_transfer',
'woocommerce_is_active',
'design_type',
'site_goals'
'site_goals',
);

protected static $jetpack_response_field_additions = array(
Expand Down Expand Up @@ -364,6 +366,9 @@ protected function render_response_key( $key, &$response, $is_user_logged_in ) {
case 'quota' :
$response[ $key ] = $this->site->get_quota();
break;
case 'launch_status' :
$response[ $key ] = $this->site->get_launch_status();
break;
}

do_action( 'post_render_site_response_key', $key );
Expand Down
4 changes: 4 additions & 0 deletions sal/class.json-api-site-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,4 +628,8 @@ function get_site_goals() {
$options = get_option( 'options' );
return empty( $options[ 'siteGoals'] ) ? null : $options[ 'siteGoals' ];
}

function get_launch_status() {
return false;
}
}

0 comments on commit 9013fdf

Please sign in to comment.