Make WordPress Core

Changeset 61828


Ignore:
Timestamp:
03/04/2026 08:04:35 PM (5 weeks ago)
Author:
ellatrix
Message:

Real-time collaboration: enable by default.

The option name is changed since the previous option name set a default value during database initialization. A default is no longer needed since the default is false.

Developed in: https://github.com/WordPress/wordpress-develop/pull/11159.

Fixes #64622.
Props czarate.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/schema.php

    r61722 r61828  
    564564        // 6.9.0
    565565        'wp_notes_notify'                   => 1,
    566 
    567         // 7.0.0
    568         'wp_enable_real_time_collaboration' => 0,
    569566    );
    570567
  • trunk/src/wp-admin/options-writing.php

    r61722 r61828  
    111111</tr>
    112112<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>
    117117</td>
    118118</tr>
  • trunk/src/wp-admin/options.php

    r61722 r61828  
    154154        'default_link_category',
    155155        'default_post_format',
    156         'wp_enable_real_time_collaboration',
     156        'wp_disable_real_time_collaboration',
    157157    ),
    158158);
  • trunk/src/wp-includes/collaboration.php

    r61722 r61828  
    1515 */
    1616function wp_collaboration_inject_setting() {
    17     if ( get_option( 'wp_enable_real_time_collaboration' ) ) {
     17    if ( ! boolval( get_option( 'wp_disable_real_time_collaboration' ) ) ) {
    1818        wp_add_inline_script(
    1919            'wp-core-data',
  • trunk/src/wp-includes/option.php

    r61722 r61828  
    28882888    register_setting(
    28892889        'writing',
    2890         'wp_enable_real_time_collaboration',
     2890        'wp_disable_real_time_collaboration',
    28912891        array(
    28922892            'type'              => 'boolean',
    2893             'description'       => __( 'Enable Real-Time Collaboration' ),
     2893            'description'       => __( 'Disable real-time collaboration' ),
    28942894            'sanitize_callback' => 'rest_sanitize_boolean',
    28952895            'default'           => false,
  • trunk/src/wp-includes/post.php

    r61789 r61828  
    658658    );
    659659
    660     if ( get_option( 'wp_enable_real_time_collaboration' ) ) {
     660    if ( ! boolval( get_option( 'wp_disable_real_time_collaboration' ) ) ) {
    661661        register_post_type(
    662662            'wp_sync_storage',
     
    86728672    );
    86738673
    8674     if ( get_option( 'wp_enable_real_time_collaboration' ) ) {
     8674    if ( ! boolval( get_option( 'wp_disable_real_time_collaboration' ) ) ) {
    86758675        register_meta(
    86768676            'post',
  • trunk/src/wp-includes/rest-api.php

    r61722 r61828  
    431431
    432432    // Collaboration.
    433     if ( get_option( 'wp_enable_real_time_collaboration' ) ) {
     433    if ( ! boolval( get_option( 'wp_disable_real_time_collaboration' ) ) ) {
    434434        $sync_storage = new WP_Sync_Post_Meta_Storage();
    435435        $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  
    255255         *   document, which can lead to duplicate inserts or deletions.
    256256         */
    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 ) {
    260260            /*
    261261             * 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  
    571571
    572572    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' );
    575574
    576575        wp_set_current_user( self::$editor_id );
     
    608607
    609608        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' );
    611610    }
    612611
     
    749748
    750749    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' );
    753751
    754752        wp_set_current_user( self::$editor_id );
     
    769767        $this->assertSame( self::$child_draft_page_id, $data['id'] );
    770768        $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' );
    772771    }
    773772
     
    935934     */
    936935    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' );
    939937
    940938        wp_set_current_user( self::$editor_id );
     
    975973
    976974        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' );
    978976    }
    979977
     
    983981     */
    984982    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' );
    987984
    988985        wp_set_current_user( self::$editor_id );
     
    10041001        $this->assertNotSame( self::$child_draft_page_id, $data['id'] );
    10051002        $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' );
    10071005    }
    10081006}
  • trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php

    r61749 r61828  
    120120            'default_comment_status',
    121121            'site_icon', // Registered in wp-includes/blocks/site-logo.php
    122             'wp_enable_real_time_collaboration',
     122            'wp_disable_real_time_collaboration',
    123123            // Connectors API keys are registered in _wp_register_default_connector_settings() in wp-includes/connectors.php.
    124124            'connectors_ai_anthropic_api_key',
  • trunk/tests/phpunit/tests/rest-api/rest-sync-server.php

    r61722 r61828  
    1515
    1616    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' );
    1818
    1919        self::$editor_id     = $factory->user->create( array( 'role' => 'editor' ) );
     
    2626        self::delete_user( self::$subscriber_id );
    2727        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' );
    2929    }
    3030
  • trunk/tests/qunit/fixtures/wp-api-generated.js

    r61824 r61828  
    2121        "wp-site-health/v1",
    2222        "wp-block-editor/v1",
    23         "wp-abilities/v1"
     23        "wp-abilities/v1",
     24        "wp-sync/v1"
    2425    ],
    2526    "authentication": {
     
    1115811159                            "required": false
    1115911160                        },
    11160                         "wp_enable_real_time_collaboration": {
     11161                        "wp_disable_real_time_collaboration": {
    1116111162                            "title": "",
    11162                             "description": "Enable Real-Time Collaboration",
     11163                            "description": "Disable real-time collaboration",
    1116311164                            "type": "boolean",
    1116411165                            "required": false
     
    1277112772                }
    1277212773            ]
     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            }
    1277312882        }
    1277412883    },
     
    1466914778    "default_category": 1,
    1467014779    "default_post_format": "0",
    14671     "wp_enable_real_time_collaboration": false,
     14780    "wp_disable_real_time_collaboration": false,
    1467214781    "posts_per_page": 10,
    1467314782    "show_on_front": "posts",
Note: See TracChangeset for help on using the changeset viewer.