Skip to content

Commit

Permalink
Fix options API on WPCOM (#41420)
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk authored and matticbot committed Jan 31, 2025
1 parent 9de3653 commit ba97bcc
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 125 deletions.
1 change: 1 addition & 0 deletions jetpack_vendor/automattic/jetpack-publicize/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This is an alpha version! The changes listed here are not final.

### Fixed
- Fix the default value for UTM settings schema
- Social | Fix the API calls on WPCOM for options

## [0.58.0] - 2025-01-27
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,21 @@ public static function on_jetpack_feature_publicize_enabled() {
add_action( 'rest_api_init', array( static::class, 'register_core_options' ) );
add_action( 'admin_init', array( static::class, 'register_core_options' ) );

if ( ( new Host() )->is_wpcom_simple() ) {

wpcom_rest_api_v2_load_plugin( Jetpack_Social_Settings\Settings::class );
} else {
// Load the settings page.
new Jetpack_Social_Settings\Settings();
}

( new Social_Image_Generator\Setup() )->init();
}

/**
* Registers the core options for the Publicize package.
*/
public static function register_core_options() {
( new Jetpack_Social_Settings\Settings() )->register_settings();
( new Jetpack_Social_Settings\Dismissed_Notices() )->register();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ class Settings {
),
);

/**
* Whether the actions have been hooked into.
*
* @var bool
*/
protected static $actions_hooked_in = false;

/**
* Constructor.
*/
public function __construct() {

if ( ! self::$actions_hooked_in ) {
add_action( 'rest_api_init', array( $this, 'register_settings' ) );
add_action( 'admin_init', array( $this, 'register_settings' ) );

self::$actions_hooked_in = true;
}
}

/**
* Migrate old options to the new settings. Previously SIG settings were stored in the
* jetpack_social_image_generator_settings option. Now they are stored in the jetpack_social_settings.
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
),
'jetpack-publicize-pkg' => array(
'path' => 'jetpack_vendor/automattic/jetpack-publicize',
'ver' => '0.59.0-alpha1738252356',
'ver' => '0.59.0-alpha1738313682',
),
'jetpack-search-pkg' => array(
'path' => 'jetpack_vendor/automattic/jetpack-search',
Expand Down
Loading

0 comments on commit ba97bcc

Please sign in to comment.