Allow enabling RTC when encountering a locked post#77380
Allow enabling RTC when encountering a locked post#77380JDeepD wants to merge 1 commit intoWordPress:trunkfrom
Conversation
When a user who can enable RTC encounters a locked post being edited by someone else, they are provided with an option to enable RTC in the Post Locked modal. This patch implements this using the heartbeats that are sent from the server to the clients.
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @JDeepD! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
| return $response; | ||
| } | ||
|
|
||
| $is_rtc_enabled = get_option( 'wp_collaboration_enabled', false ); |
There was a problem hiding this comment.
Currently, it sends back whatever is set in wp_collaboration_enabled setting. However, #75072 discusses on a more granular option for enabling RTC per CPT. Depending on how the granular control is implemented, we will have to change this accordingly.
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
When a user who can enable RTC encounters a locked post being edited by someone else, they are provided with an option to enable RTC in the Post Locked modal.
This patch implements this using the heartbeats that are sent from the server to the clients.
The user who enables the RTC updates the setting directly through their client. All the other clients are informed through the heartbeat that RTC has been enabled in settings which prompts them to save and reload their client so that RTC is enable for their client as well.
This change also requires to update the heartbeat processing logic in Core to send
real_time_collaborationstate as in this branch.Closes #76666
Why?
This change is necessary so that we do not have to ask the client editing the post to exit out of the editor and edit again after we have enabled RTC.
How?
real_time_collaborationstate. This state is taken from the admin options and always reflects the state as it is in the backend. When User A's client finds thatreal_time_collaborationis true in the heartbeat but it is false in the window, it informs the user that RTC has been enabled by someone else and asks them to save and reload the page to update the window state with appropriate RTC states.Testing Instructions
Here are the complete testing instructions to add to your PR. They cover the happy path, the heartbeat sync, and the security permissions check we implemented.
Testing Instructions
Screenshots or screencast
rtc-colab.mov
Use of AI Tools