Editor: rename sync_status and move it to top level.

Renames sync_status to wp_pattern_sync_status and moves it to top level field of wp_block post type.

Props glendaviesnz, aaronrobertshaw, mukesh27, peterwilsoncc.
Fixes 58677.


git-svn-id: https://develop.svn.wordpress.org/trunk@56160 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Isabel Brison
2023-07-07 07:27:53 +00:00
parent f47b9a2075
commit 7035b615c4
3 changed files with 41 additions and 2 deletions
@@ -220,4 +220,39 @@ class REST_Blocks_Controller_Test extends WP_UnitTestCase {
$data['content']
);
}
/**
* Check that the `wp_pattern_sync_status` postmeta is moved from meta array to top
* level of response.
*
* @ticket 58677
*/
public function test_wp_patterns_sync_status_post_meta() {
register_post_meta(
'wp_block',
'wp_pattern_sync_status',
array(
'single' => true,
'type' => 'string',
'show_in_rest' => array(
'schema' => array(
'type' => 'string',
'properties' => array(
'sync_status' => array(
'type' => 'string',
),
),
),
),
)
);
wp_set_current_user( self::$user_ids['author'] );
$request = new WP_REST_Request( 'GET', '/wp/v2/blocks/' . self::$post_id );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
$this->assertArrayHasKey( 'wp_pattern_sync_status', $data );
$this->assertArrayNotHasKey( 'wp_pattern_sync_status', $data['meta'] );
}
}