-
Notifications
You must be signed in to change notification settings - Fork 4.7k
RTC: Change RTC option name #76643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTC: Change RTC option name #76643
Changes from all commits
41e6d89
980d57c
d826466
a859af4
e8fd12a
9f75d80
2fd35cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| https://github.com/WordPress/wordpress-develop/pull/11289 | ||
|
|
||
| * https://github.com/WordPress/gutenberg/pull/76643 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,7 +103,7 @@ function gutenberg_rest_api_crdt_post_meta() { | |
| * Registers the real-time collaboration setting. | ||
| */ | ||
| function gutenberg_register_real_time_collaboration_setting() { | ||
| $option_name = 'wp_enable_real_time_collaboration'; | ||
| $option_name = 'wp_collaboration_enabled'; | ||
|
|
||
| register_setting( | ||
| 'writing', | ||
|
|
@@ -124,8 +124,8 @@ function () use ( $option_name ) { | |
| $option_value = get_option( $option_name ); | ||
|
|
||
| ?> | ||
| <label for="wp_enable_real_time_collaboration"> | ||
| <input name="wp_enable_real_time_collaboration" type="checkbox" id="wp_enable_real_time_collaboration" value="1" <?php checked( '1', $option_value ); ?>/> | ||
| <label for="wp_collaboration_enabled"> | ||
| <input name="wp_collaboration_enabled" type="checkbox" id="wp_collaboration_enabled" value="1" <?php checked( '1', $option_value ); ?>/> | ||
| <?php _e( 'Enable real-time collaboration', 'gutenberg' ); ?> | ||
| </label> | ||
| <?php | ||
|
|
@@ -142,6 +142,12 @@ function () use ( $option_name ) { | |
| function gutenberg_inject_real_time_collaboration_setting() { | ||
| global $pagenow; | ||
|
|
||
| if ( ! get_option( 'wp_collaboration_enabled' ) ) { | ||
| return; | ||
| } | ||
|
|
||
| // Temporary check to bridge the short time when this is change is merged in | ||
| // Gutenberg but not in core. | ||
| if ( ! get_option( 'wp_enable_real_time_collaboration' ) ) { | ||
| return; | ||
| } | ||
|
|
@@ -162,7 +168,12 @@ function gutenberg_inject_real_time_collaboration_setting() { | |
| ); | ||
| } | ||
| add_action( 'admin_init', 'gutenberg_inject_real_time_collaboration_setting' ); | ||
| add_filter( 'default_option_wp_enable_real_time_collaboration', '__return_true' ); | ||
|
|
||
| /** | ||
| * Core filters the default value, so hook with a higher priority to ensure the | ||
| * setting is enabled by default when the Gutenberg plugin is active. | ||
| */ | ||
| add_filter( 'default_option_wp_collaboration_enabled', '__return_true', 500 ); | ||
|
Comment on lines
+172
to
+176
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this code will work. In the latest WordPress core, the initialization process persists the default value of As a result, it appears that the e2e test is failing because RTC is not enabled.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noting that @alecgeatches and I are fixing those e2e tests for collaboration in #76704 |
||
|
|
||
| /** | ||
| * Modifies the post list UI and heartbeat responses for real-time collaboration. | ||
|
|
@@ -175,7 +186,7 @@ function gutenberg_inject_real_time_collaboration_setting() { | |
| function gutenberg_post_list_collaboration_ui() { | ||
| global $pagenow; | ||
|
|
||
| if ( ! get_option( 'wp_enable_real_time_collaboration' ) ) { | ||
| if ( ! get_option( 'wp_collaboration_enabled' ) ) { | ||
chriszarate marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the upgrade code runs in Gutenberg, this option won't be here anymore then. Is it still needed?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is needed only for the brief window when this PR is open against / merged into Gutenberg and the equivalent change is not yet merged into Core
trunk(since E2E tests run against Coretrunk). After that, it can be removed.