Skip to content

Commit

Permalink
Support site_intent for /me/sites endpoint
Browse files Browse the repository at this point in the history
Summary:
As we need to show different support articles according to the site intent, add `site_intent` into options list so that we can query from the `/me/sites` endpoint

Related to Automattic/wp-calypso#58486

Test Plan:
1. Go to https://[private link]
2. Select WP.COM API > v1.2
3. Use `/me/sites?fields=options&options=site_intent`
4. Check the response of sites contains `site_intent`

Also, you can follow the testing instructions from Automattic/wp-calypso#58486

Reviewers: #ganon_team, philipmjackson

Reviewed By: #ganon_team, philipmjackson

Subscribers: philipmjackson

Tags: #touches_jetpack_files

Differential Revision: D70637-code

This commit syncs r235663-wpcom.
  • Loading branch information
arthur791004 committed Nov 26, 2021
1 parent 28b3cbc commit 9a3d668
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
'is_cloud_eligible',
'selected_features',
'anchor_podcast',
'site_intent',
);

protected static $jetpack_response_field_additions = array(
Expand Down Expand Up @@ -669,6 +670,9 @@ protected function render_option_keys( &$options_response_keys ) {
case 'anchor_podcast':
$options[ $key ] = $site->get_anchor_podcast();
break;
case 'site_intent':
$options[ $key ] = $site->get_site_intent();
break;
}
}

Expand Down
7 changes: 7 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 @@ -726,4 +726,11 @@ public function get_selected_features() {
public function get_anchor_podcast() {
return get_option( 'anchor_podcast' );
}

/**
* Get the option of site intent which value is coming from the Hero Flow
*/
public function get_site_intent() {
return get_option( 'site_intent', '' );
}
}

0 comments on commit 9a3d668

Please sign in to comment.