Changeset 61828
- Timestamp:
- 03/04/2026 08:04:35 PM (5 weeks ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
src/wp-admin/includes/schema.php (modified) (1 diff)
-
src/wp-admin/options-writing.php (modified) (1 diff)
-
src/wp-admin/options.php (modified) (1 diff)
-
src/wp-includes/collaboration.php (modified) (1 diff)
-
src/wp-includes/option.php (modified) (1 diff)
-
src/wp-includes/post.php (modified) (2 diffs)
-
src/wp-includes/rest-api.php (modified) (1 diff)
-
src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php (modified) (1 diff)
-
tests/phpunit/tests/rest-api/rest-autosaves-controller.php (modified) (8 diffs)
-
tests/phpunit/tests/rest-api/rest-settings-controller.php (modified) (1 diff)
-
tests/phpunit/tests/rest-api/rest-sync-server.php (modified) (2 diffs)
-
tests/qunit/fixtures/wp-api-generated.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/schema.php
r61722 r61828 564 564 // 6.9.0 565 565 'wp_notes_notify' => 1, 566 567 // 7.0.0568 'wp_enable_real_time_collaboration' => 0,569 566 ); 570 567 -
trunk/src/wp-admin/options-writing.php
r61722 r61828 111 111 </tr> 112 112 <tr> 113 <th scope="row"><label for="wp_ enable_real_time_collaboration"><?php _e( 'Collaboration' ); ?></label></th>114 <td> 115 <input name="wp_ enable_real_time_collaboration" type="checkbox" id="wp_enable_real_time_collaboration" value="1" <?php checked( '1', get_option( 'wp_enable_real_time_collaboration' ) ); ?> />116 <label for="wp_ enable_real_time_collaboration"><?php _e( 'Enable real-time collaboration' ); ?></label>113 <th scope="row"><label for="wp_disable_real_time_collaboration"><?php _e( 'Collaboration' ); ?></label></th> 114 <td> 115 <input name="wp_disable_real_time_collaboration" type="checkbox" id="wp_disable_real_time_collaboration" value="1" <?php checked( '1', get_option( 'wp_disable_real_time_collaboration' ) ); ?> /> 116 <label for="wp_disable_real_time_collaboration"><?php _e( 'Disable real-time collaboration' ); ?></label> 117 117 </td> 118 118 </tr> -
trunk/src/wp-admin/options.php
r61722 r61828 154 154 'default_link_category', 155 155 'default_post_format', 156 'wp_ enable_real_time_collaboration',156 'wp_disable_real_time_collaboration', 157 157 ), 158 158 ); -
trunk/src/wp-includes/collaboration.php
r61722 r61828 15 15 */ 16 16 function wp_collaboration_inject_setting() { 17 if ( get_option( 'wp_enable_real_time_collaboration') ) {17 if ( ! boolval( get_option( 'wp_disable_real_time_collaboration' ) ) ) { 18 18 wp_add_inline_script( 19 19 'wp-core-data', -
trunk/src/wp-includes/option.php
r61722 r61828 2888 2888 register_setting( 2889 2889 'writing', 2890 'wp_ enable_real_time_collaboration',2890 'wp_disable_real_time_collaboration', 2891 2891 array( 2892 2892 'type' => 'boolean', 2893 'description' => __( ' Enable Real-Time Collaboration' ),2893 'description' => __( 'Disable real-time collaboration' ), 2894 2894 'sanitize_callback' => 'rest_sanitize_boolean', 2895 2895 'default' => false, -
trunk/src/wp-includes/post.php
r61789 r61828 658 658 ); 659 659 660 if ( get_option( 'wp_enable_real_time_collaboration') ) {660 if ( ! boolval( get_option( 'wp_disable_real_time_collaboration' ) ) ) { 661 661 register_post_type( 662 662 'wp_sync_storage', … … 8672 8672 ); 8673 8673 8674 if ( get_option( 'wp_enable_real_time_collaboration') ) {8674 if ( ! boolval( get_option( 'wp_disable_real_time_collaboration' ) ) ) { 8675 8675 register_meta( 8676 8676 'post', -
trunk/src/wp-includes/rest-api.php
r61722 r61828 431 431 432 432 // Collaboration. 433 if ( get_option( 'wp_enable_real_time_collaboration') ) {433 if ( ! boolval( get_option( 'wp_disable_real_time_collaboration' ) ) ) { 434 434 $sync_storage = new WP_Sync_Post_Meta_Storage(); 435 435 $sync_server = new WP_HTTP_Polling_Sync_Server( $sync_storage ); -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
r61722 r61828 255 255 * document, which can lead to duplicate inserts or deletions. 256 256 */ 257 $is_collaboration_ enabled = get_option( 'wp_enable_real_time_collaboration');258 259 if ( $is_draft && (int) $post->post_author === $user_id && ! $post_lock && ! $is_collaboration_enabled ) {257 $is_collaboration_disabled = boolval( get_option( 'wp_disable_real_time_collaboration' ) ); 258 259 if ( $is_draft && (int) $post->post_author === $user_id && ! $post_lock && $is_collaboration_disabled ) { 260 260 /* 261 261 * Draft posts for the same author: autosaving updates the post and does not create a revision. -
trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php
r61722 r61828 571 571 572 572 public function test_rest_autosave_draft_post_same_author() { 573 $original_option = get_option( 'wp_enable_real_time_collaboration' ); 574 update_option( 'wp_enable_real_time_collaboration', false ); 573 add_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_true' ); 575 574 576 575 wp_set_current_user( self::$editor_id ); … … 608 607 609 608 wp_delete_post( $post_id ); 610 update_option( 'wp_enable_real_time_collaboration', $original_option);609 remove_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_true' ); 611 610 } 612 611 … … 749 748 750 749 public function test_update_item_draft_page_with_parent() { 751 $original_option = get_option( 'wp_enable_real_time_collaboration' ); 752 update_option( 'wp_enable_real_time_collaboration', false ); 750 add_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_true' ); 753 751 754 752 wp_set_current_user( self::$editor_id ); … … 769 767 $this->assertSame( self::$child_draft_page_id, $data['id'] ); 770 768 $this->assertSame( self::$parent_page_id, $data['parent'] ); 771 update_option( 'wp_enable_real_time_collaboration', $original_option ); 769 770 remove_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_true' ); 772 771 } 773 772 … … 935 934 */ 936 935 public function test_rest_autosave_draft_post_same_author_with_rtc() { 937 $original_option = get_option( 'wp_enable_real_time_collaboration' ); 938 update_option( 'wp_enable_real_time_collaboration', true ); 936 add_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_false' ); 939 937 940 938 wp_set_current_user( self::$editor_id ); … … 975 973 976 974 wp_delete_post( $post_id ); 977 update_option( 'wp_enable_real_time_collaboration', $original_option);975 remove_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_false' ); 978 976 } 979 977 … … 983 981 */ 984 982 public function test_update_item_draft_page_with_parent_with_rtc() { 985 $original_option = get_option( 'wp_enable_real_time_collaboration' ); 986 update_option( 'wp_enable_real_time_collaboration', true ); 983 add_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_false' ); 987 984 988 985 wp_set_current_user( self::$editor_id ); … … 1004 1001 $this->assertNotSame( self::$child_draft_page_id, $data['id'] ); 1005 1002 $this->assertSame( self::$child_draft_page_id, $data['parent'] ); 1006 update_option( 'wp_enable_real_time_collaboration', $original_option ); 1003 1004 remove_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_false' ); 1007 1005 } 1008 1006 } -
trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php
r61749 r61828 120 120 'default_comment_status', 121 121 'site_icon', // Registered in wp-includes/blocks/site-logo.php 122 'wp_ enable_real_time_collaboration',122 'wp_disable_real_time_collaboration', 123 123 // Connectors API keys are registered in _wp_register_default_connector_settings() in wp-includes/connectors.php. 124 124 'connectors_ai_anthropic_api_key', -
trunk/tests/phpunit/tests/rest-api/rest-sync-server.php
r61722 r61828 15 15 16 16 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 17 update_option( 'wp_enable_real_time_collaboration', true);17 add_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_false' ); 18 18 19 19 self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); … … 26 26 self::delete_user( self::$subscriber_id ); 27 27 wp_delete_post( self::$post_id, true ); 28 delete_option( 'wp_enable_real_time_collaboration' );28 remove_filter( 'pre_option_wp_disable_real_time_collaboration', '__return_false' ); 29 29 } 30 30 -
trunk/tests/qunit/fixtures/wp-api-generated.js
r61824 r61828 21 21 "wp-site-health/v1", 22 22 "wp-block-editor/v1", 23 "wp-abilities/v1" 23 "wp-abilities/v1", 24 "wp-sync/v1" 24 25 ], 25 26 "authentication": { … … 11158 11159 "required": false 11159 11160 }, 11160 "wp_ enable_real_time_collaboration": {11161 "wp_disable_real_time_collaboration": { 11161 11162 "title": "", 11162 "description": " Enable Real-Time Collaboration",11163 "description": "Disable real-time collaboration", 11163 11164 "type": "boolean", 11164 11165 "required": false … … 12771 12772 } 12772 12773 ] 12774 }, 12775 "/wp-sync/v1": { 12776 "namespace": "wp-sync/v1", 12777 "methods": [ 12778 "GET" 12779 ], 12780 "endpoints": [ 12781 { 12782 "methods": [ 12783 "GET" 12784 ], 12785 "args": { 12786 "namespace": { 12787 "default": "wp-sync/v1", 12788 "required": false 12789 }, 12790 "context": { 12791 "default": "view", 12792 "required": false 12793 } 12794 } 12795 } 12796 ], 12797 "_links": { 12798 "self": [ 12799 { 12800 "href": "http://example.org/index.php?rest_route=/wp-sync/v1" 12801 } 12802 ] 12803 } 12804 }, 12805 "/wp-sync/v1/updates": { 12806 "namespace": "wp-sync/v1", 12807 "methods": [ 12808 "POST" 12809 ], 12810 "endpoints": [ 12811 { 12812 "methods": [ 12813 "POST" 12814 ], 12815 "args": { 12816 "rooms": { 12817 "items": { 12818 "properties": { 12819 "after": { 12820 "minimum": 0, 12821 "required": true, 12822 "type": "integer" 12823 }, 12824 "awareness": { 12825 "required": true, 12826 "type": [ 12827 "object", 12828 "null" 12829 ] 12830 }, 12831 "client_id": { 12832 "minimum": 1, 12833 "required": true, 12834 "type": "integer" 12835 }, 12836 "room": { 12837 "required": true, 12838 "type": "string", 12839 "pattern": "^[^/]+/[^/:]+(?::\\S+)?$" 12840 }, 12841 "updates": { 12842 "items": { 12843 "properties": { 12844 "data": { 12845 "type": "string", 12846 "required": true 12847 }, 12848 "type": { 12849 "type": "string", 12850 "required": true, 12851 "enum": [ 12852 "compaction", 12853 "sync_step1", 12854 "sync_step2", 12855 "update" 12856 ] 12857 } 12858 }, 12859 "required": true, 12860 "type": "object" 12861 }, 12862 "minItems": 0, 12863 "required": true, 12864 "type": "array" 12865 } 12866 }, 12867 "type": "object" 12868 }, 12869 "type": "array", 12870 "required": true 12871 } 12872 } 12873 } 12874 ], 12875 "_links": { 12876 "self": [ 12877 { 12878 "href": "http://example.org/index.php?rest_route=/wp-sync/v1/updates" 12879 } 12880 ] 12881 } 12773 12882 } 12774 12883 }, … … 14669 14778 "default_category": 1, 14670 14779 "default_post_format": "0", 14671 "wp_ enable_real_time_collaboration": false,14780 "wp_disable_real_time_collaboration": false, 14672 14781 "posts_per_page": 10, 14673 14782 "show_on_front": "posts",
Note: See TracChangeset
for help on using the changeset viewer.