Skip to content

Commit

Permalink
A4A Dev Sites: Add is_a4a_dev_site attribute to sites API response. (
Browse files Browse the repository at this point in the history
…#38964)

* Add is_a4a_dev_site attribute to sites API response.

* Add changelog.
  • Loading branch information
yansern authored Aug 20, 2024
1 parent 46d3cdb commit e5f1d13
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/site-is-a4a-dev-site
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Add a4a_is_dev_site attribute to Sites API response.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
'wpcom_site_setup' => '(string) The WP.com site setup identifier.',
'is_deleted' => '(bool) If the site flagged as deleted.',
'is_a4a_client' => '(bool) If the site is an A4A client site.',
'is_a4a_dev_site' => '(bool) If the site is an A4A dev site.',
);

/**
Expand Down Expand Up @@ -120,6 +121,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
'is_wpcom_staging_site',
'is_deleted',
'is_a4a_client',
'is_a4a_dev_site',
);

/**
Expand Down Expand Up @@ -612,6 +614,9 @@ protected function render_response_key( $key, &$response, $is_user_logged_in ) {
case 'is_a4a_client':
$response[ $key ] = $this->site->is_a4a_client();
break;
case 'is_a4a_dev_site':
$response[ $key ] = $this->site->is_a4a_dev_site();
break;
}

do_action( 'post_render_site_response_key', $key );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class WPCOM_JSON_API_GET_Site_V1_2_Endpoint extends WPCOM_JSON_API_GET_Site_Endp
'was_hosting_trial' => '(bool) If the site ever used a hosting trial.',
'is_deleted' => '(bool) If the site flagged as deleted.',
'is_a4a_client' => '(bool) If the site is an A4A client site.',
'is_a4a_dev_site' => '(bool) If the site is an A4A dev site.',
);

/**
Expand Down
12 changes: 12 additions & 0 deletions projects/plugins/jetpack/sal/class.json-api-site-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,18 @@ abstract public function is_deleted();
*/
abstract public function is_a4a_client();

/**
* Indicates that a site is an A4A dev site.
*
* @return bool
*/
public function is_a4a_dev_site() {
if ( function_exists( 'has_blog_sticker' ) ) {
return has_blog_sticker( 'a4a-is-dev-site' );
}
return false;
}

/**
* Return the user interactions with a site. Not used in Jetpack.
*
Expand Down

0 comments on commit e5f1d13

Please sign in to comment.