Skip to content

Commit

Permalink
Sync: Consider whitelisted option filters (#11094)
Browse files Browse the repository at this point in the history
Currently, when we check whether an option is whitelisted for syncing, we check against the default list of options. This means that any additional options that we register by using the filters aren't considered. This PR changes this, so now the filters will be considered and any options that have been added by using those filters will be synced.

This PR is a companion to D22745-code

#### Changes proposed in this Pull Request:

* Consider option whitelist filters when checking whether an option is whitelisted.

#### Testing instructions:
* See D22745-code

#### Proposed changelog entry for your changes:

* Consider option whitelist filters when checking whether an option is whitelisted.
  • Loading branch information
tyxla authored and jeherve committed Jan 24, 2019
1 parent f899f22 commit d49ce0a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sync/class.jetpack-sync-defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ public static function get_comment_meta_whitelist() {
);

static function is_whitelisted_option( $option ) {
foreach ( self::$default_options_whitelist as $whitelisted_option ) {
$whitelisted_options = self::get_options_whitelist();
foreach ( $whitelisted_options as $whitelisted_option ) {
if ( $whitelisted_option[0] === '/' && preg_match( $whitelisted_option, $option ) ) {
return true;
} elseif ( $whitelisted_option === $option ) {
Expand Down

0 comments on commit d49ce0a

Please sign in to comment.