-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Real-time collaboration: Hide lock modal based on user access to feature #72644
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
Conversation
|
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. |
|
Size Change: +26 B (0%) Total Size: 2.19 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 477778d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18761675687
|
| } | ||
| // If both the current user and the lock owner can collaboratively edit, do not | ||
| // show the modal. | ||
| if ( syncEnabled && user.syncEnabled ) { |
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.
Alternative solution: could a filter be added on this syncEnabled property that allows it to be customized? So that way, a plugin like say our RTC plugin could use other factors to decide if it sync should be enabled or not. That way, we aren't tying this branch to our plugin and are opening the door to other plugins to make decisions on if sync should be enabled selectively or not.
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.
Yes, we could filter in 2-3 spots for the same effect. Still unlikely to be merged IMO.
| if ( globalThis.IS_GUTENBERG_PLUGIN ) { | ||
| return null; | ||
| } | ||
| // If both the current user and the lock owner can collaboratively edit, do not |
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.
Unless I'm misinterpreting the code, isn't this checking the user against the permissions of the post type since syncEnabled is checking for the experimental flag and the config of the post type?
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.
Yes. If the post type does not support collaborative editing, you also cannot collaboratively edit.
|
Closing this in favor of a different approach: Privileged users can turn off collaborative editing for a single post using a toggle or button. |
What?
Hide the post lock modal based on user access to the collaborative editing feature.
Why?
If we want to allow users with access to the feature to exist alongside users without access, we need a way to selectively enforce the post lock.
How?
If both the current user and the lock owner have access to the collaborative editing feature, then we can safely ignore the post lock (but continue updating it in the background). Otherwise, defer to the current behavior of the post lock.
Testing Instructions
See Automattic/vip-real-time-collaboration#76
Testing Instructions for Keyboard
No UI changes in this PR.