Skip to content

Commit d2bbd48

Browse files
alshakeromatticbot
authored andcommitted
Help Center: Persist router state - proxy the request (#43826)
Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/15536126786 Upstream-Ref: Automattic/jetpack@3a63fd2
1 parent 53efb1f commit d2bbd48

File tree

9 files changed

+120
-103
lines changed

9 files changed

+120
-103
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"require": {
77
"php": ">=8.1",
88
"automattic/jetpack-composer-plugin": "^4.0.5",
9-
"automattic/jetpack-mu-wpcom": "^6.5.0"
9+
"automattic/jetpack-mu-wpcom": "^6.6.0-alpha"
1010
},
1111
"require-dev": {
1212
"yoast/phpunit-polyfills": "^4.0.0",

composer.lock

Lines changed: 33 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jetpack_vendor/automattic/jetpack-mu-wpcom/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [6.6.0-alpha] - unreleased
9+
10+
This is an alpha version! The changes listed here are not final.
11+
12+
### Added
13+
- Persist the Help Center Router state in user preferences
14+
815
## [6.5.0] - 2025-06-06
916
### Changed
1017
- Update `Edit homepage` banner design and copy. [#43643]
@@ -1591,6 +1598,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15911598

15921599
- Testing initial package release.
15931600

1601+
[6.6.0-alpha]: https://github.com/Automattic/jetpack-mu-wpcom/compare/v6.5.0...v6.6.0-alpha
15941602
[6.5.0]: https://github.com/Automattic/jetpack-mu-wpcom/compare/v6.4.0...v6.5.0
15951603
[6.4.0]: https://github.com/Automattic/jetpack-mu-wpcom/compare/v6.3.1...v6.4.0
15961604
[6.3.1]: https://github.com/Automattic/jetpack-mu-wpcom/compare/v6.3.0...v6.3.1

jetpack_vendor/automattic/jetpack-mu-wpcom/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
},
6262
"autotagger": true,
6363
"branch-alias": {
64-
"dev-trunk": "6.5.x-dev"
64+
"dev-trunk": "6.6.x-dev"
6565
},
6666
"textdomain": "jetpack-mu-wpcom",
6767
"version-constants": {

jetpack_vendor/automattic/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Jetpack_Mu_Wpcom main class.
1515
*/
1616
class Jetpack_Mu_Wpcom {
17-
const PACKAGE_VERSION = '6.5.0';
17+
const PACKAGE_VERSION = '6.6.0-alpha';
1818
const PKG_DIR = __DIR__ . '/../';
1919
const BASE_DIR = __DIR__ . '/';
2020
const BASE_FILE = __FILE__;

jetpack_vendor/automattic/jetpack-mu-wpcom/src/features/help-center/class-wp-rest-help-center-persisted-open-state.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ public function get_state() {
6363

6464
$response = json_decode( wp_remote_retrieve_body( $body ) );
6565

66-
$is_open = $response->help_center_open ?? false;
66+
$is_open = $response->help_center_open ?? false;
67+
$router_history = $response->help_center_router_history ?? null;
6768

6869
$projected_response = array(
69-
'help_center_open' => (bool) $is_open,
70+
'help_center_open' => (bool) $is_open,
71+
'help_center_router_history' => $router_history,
7072
);
7173

7274
return rest_ensure_response( $projected_response );
@@ -78,7 +80,8 @@ public function get_state() {
7880
* @param \WP_REST_Request $request The request sent to the API.
7981
*/
8082
public function set_state( \WP_REST_Request $request ) {
81-
$state = $request['help_center_open'];
83+
$state = $request['help_center_open'];
84+
$router_history = $request['help_center_router_history'];
8285

8386
$data = array(
8487
'calypso_preferences' => array(),
@@ -88,6 +91,10 @@ public function set_state( \WP_REST_Request $request ) {
8891
$data['calypso_preferences']['help_center_open'] = $state;
8992
}
9093

94+
if ( $request->has_param( 'help_center_router_history' ) ) {
95+
$data['calypso_preferences']['help_center_router_history'] = $router_history;
96+
}
97+
9198
$body = Client::wpcom_json_api_request_as_user(
9299
'/me/preferences',
93100
'2',
@@ -101,11 +108,13 @@ public function set_state( \WP_REST_Request $request ) {
101108

102109
$response = json_decode( wp_remote_retrieve_body( $body ) );
103110

104-
$is_open = $response->calypso_preferences->help_center_open ?? false;
111+
$is_open = $response->calypso_preferences->help_center_open ?? false;
112+
$router_history = $response->calypso_preferences->help_center_router_history ?? null;
105113

106114
$projected_response = array(
107115
'calypso_preferences' => array(
108-
'help_center_open' => (bool) $is_open,
116+
'help_center_open' => (bool) $is_open,
117+
'help_center_router_history' => $router_history,
109118
),
110119
);
111120

0 commit comments

Comments
 (0)