[Bug?] Initial draft document still appears, even if setting draft: false
#1364
-
Hey, I have been using the draft functionality and it works okay for most cases. For example, when I edit a published document and save it as draft, The only issue I have is when creating an initial document. If I save it as a draft, it still appears in the GraphQL results, even though parameter draft is set to false and Query:
Data:
payload setting: Expected behaviour: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You need to write access control to restrict who can see documents with The Take a look at the docs here: |
Beta Was this translation helpful? Give feedback.
You need to write access control to restrict who can see documents with
status: '_draft'
.The
?draft=true
REST query parameter is only responsible for replacing documents' contents with their newest draft content and does not have any restrictions around who can see the documents returned vs. who can't. That's a job for access control.Take a look at the docs here:
https://payloadcms.com/docs/versions/drafts#controlling-who-can-see-collection-drafts