Mutations should respect edit locks #379
Labels
Architecture
Component: Mutations
focus: mutation refactor
for use with GH projects
not stale
Short-circuits stalebot. USE SPARINGLY
ObjectType: Post
Issues related to the Post object type in WP
Status: 🚀 Actionable
Issues that have been curated, have enough info to take action, and are ready to be worked on
Type: Enhancement
New feature or request
Milestone
In the WordPress dashboard, when a user is editing a post, an edit lock is set on the post.
Any other user in the dashboard will see that another user is currently editing the post. They can take over, but it requires action on their behalf to acknowledge that they are going to override the other users changes.
WPGraphQL enables remote clients (editing content outside of the WP Dashboard). Those remote clients should have insight into who is editing the post (currently supported by WPGraphQL by querying the post's editLock field), but the remote client should also respect not editing a locked entity by default, without declaring intent to override.
I think mutations for nodes, starting with posts because WP has native locking for posts, should have an input $arg like
ignoreEditLock => boolean!
or something to that tune.That way, default GraphQL mutations will throw an exception and return an error if the post is already locked and the mutation will not occur. This allows for remote clients to respect the lock by default. If there is intent to ignore the lock (like clicking the "take over anyway" modal in the WP Dash), then
ignoreEditLock
can be set to true in the mutation, and the mutation can succeed regardless of being lockedThe text was updated successfully, but these errors were encountered: