Skip to content

Commit 1dfa4be

Browse files
Add configs for simple classic to load odyssey stats (#36633)
* Add configs for simple classic to load odyssey stats * changelog * Set the correct value for jetpack * Update unit test * Update unit test to check for is_running_in_jetpack_site --------- Co-authored-by: DustyReagan <[email protected]>
1 parent b7a2c86 commit 1dfa4be

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: changed
3+
4+
Add config fields for odyssey stats to be loaded in Simple Site Classic.

projects/packages/stats-admin/src/class-odyssey-config-data.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public function get_data() {
5757
'site_name' => \get_bloginfo( 'name' ),
5858
'sections' => array(),
5959
// Features are inlined @see https://github.com/Automattic/wp-calypso/pull/70122
60-
'features' => array(),
60+
'features' => array(
61+
'is_running_in_jetpack_site' => ! $host->is_wpcom_simple(),
62+
),
6163
// Intended for apps that do not use redux.
6264
'gmt_offset' => $this->get_gmt_offset(),
6365
'odyssey_stats_base_url' => admin_url( 'admin.php?page=stats' ),
@@ -77,7 +79,8 @@ public function get_data() {
7779
"$blog_id" => array(
7880
'ID' => $blog_id,
7981
'URL' => site_url(),
80-
'jetpack' => true,
82+
// Atomic and jetpack sites should return true.
83+
'jetpack' => ! $host->is_wpcom_simple(),
8184
'visible' => true,
8285
'capabilities' => $this->get_current_user_capabilities(),
8386
'products' => Jetpack_Plan::get_products(),
@@ -88,6 +91,7 @@ public function get_data() {
8891
'gmt_offset' => $this->get_gmt_offset(),
8992
'is_automated_transfer' => $this->is_automated_transfer( $blog_id ),
9093
'is_wpcom_atomic' => $host->is_woa_site(),
94+
'is_wpcom_simple' => $host->is_wpcom_simple(),
9195
'is_vip' => $host->is_vip_site(),
9296
'jetpack_version' => defined( 'JETPACK__VERSION' ) ? JETPACK__VERSION : '',
9397
'stats_admin_version' => Main::VERSION,

projects/packages/stats-admin/tests/php/test-odyssey-config-data.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ public function test_config_data() {
4242
$this->assertArrayHasKey( 'nonce', $data );
4343
$this->assertArrayHasKey( 'site_name', $data );
4444
$this->assertArrayHasKey( 'intial_state', $data );
45-
$this->assertEmpty( $data['features'] );
45+
$this->assertArrayHasKey( 'is_running_in_jetpack_site', $data['features'] );
4646
}
4747
}

0 commit comments

Comments
 (0)