Skip to content
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

Mutations should respect edit locks #379

Closed
Tracked by #2461
jasonbahl opened this issue Jan 31, 2018 · 6 comments · Fixed by #2643
Closed
Tracked by #2461

Mutations should respect edit locks #379

jasonbahl opened this issue Jan 31, 2018 · 6 comments · Fixed by #2643
Assignees
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

Comments

@jasonbahl
Copy link
Collaborator

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 locked

@jasonbahl jasonbahl added Type: Enhancement New feature or request Architecture labels Jan 31, 2018
@jasonbahl jasonbahl added this to To do in Roadmap Mar 20, 2018
@CodeProKid CodeProKid added the Close Candidate Needs confirmation before closing label Sep 4, 2018
@CodeProKid
Copy link
Member

I believe this is already working?

@jasonbahl
Copy link
Collaborator Author

@CodeProKid I'm not sure it actually is. 🤔

@CodeProKid
Copy link
Member

CodeProKid commented Sep 4, 2018

I think it just changes the UI. It doesn't actually prevent an update mutation from happening. I'm not sure if that's the intention here or not.

@jasonbahl
Copy link
Collaborator Author

I think if a user submits a Mutation, during the execution of the mutation the EditLock should be checked, and if it's determined that another user owns the lock, we should prevent the mutation from proceeding.

In the age of headless WP, a user could be editing from any number of clients, not just the WP-Admin, and until we figure out how to add real-time UI updates across clients, the server should be responsible for checking the lock before proceeding with executing any changes.

@CodeProKid CodeProKid removed the Close Candidate Needs confirmation before closing label Sep 11, 2018
@jasonbahl jasonbahl added this to To Prioritize in 4: Actionable Issues Aug 7, 2019
@TylerBarnes TylerBarnes added this to the 1.0 release milestone Nov 3, 2019
@TylerBarnes TylerBarnes added this to To do in V1 via automation Nov 3, 2019
@CodeProKid CodeProKid added the Status: 🚀 Actionable Issues that have been curated, have enough info to take action, and are ready to be worked on label Nov 15, 2019
@CodeProKid CodeProKid added ObjectType: Post Issues related to the Post object type in WP Component: Mutations labels Jan 17, 2020
@jasonbahl jasonbahl removed this from the 1.0 release milestone Jun 24, 2020
@justlevine justlevine added the focus: mutation refactor for use with GH projects label Jul 31, 2022
@jasonbahl jasonbahl added this to the Mutation Enhancements milestone Aug 3, 2022
@stale
Copy link

stale bot commented Nov 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale? May need to be revalidated due to prolonged inactivity label Nov 2, 2022
@jasonbahl jasonbahl added not stale Short-circuits stalebot. USE SPARINGLY and removed Stale? May need to be revalidated due to prolonged inactivity labels Nov 28, 2022
@markkelnar
Copy link
Contributor

I'm able recreate and confirm that a mutation does edit a post even when the post is actively being edited by another user in wp-admin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: Done
Roadmap
  
To do
V1
  
To do
Development

Successfully merging a pull request may close this issue.

5 participants