I want to have a simple scheduled publish feature like this
git clone git@github.com:Stupidism/seo-mono.git
git checkout feng/test-scheduled-publish
pnpm I
nx run seo-payload:serve
http://localhost:3333/admin/collections/test-drafts/62be8d54722f5bd46633ca9f
# Write your query or mutation here
query findTestDrafts {
TestDrafts {
docs {
name
publishDate
}
}
}
According to requirement and the description from the code snnipet, it should return the version that publishDate smaller than today.
Hey @Stupidism,
I'm glad to see you are exploring this solution more. Looking at the code for the access control, it is doing exactly what you're asking it to.
The access control on TestDrafts for read
first checks if a user is logged in before querying publishDate. Unless you have logged out it won't bother querying the way you are expecting.
When you are querying in step 5, try from an incognito window or add a step to logout from the admin UI first.
I was able to do this from your repro to be sure.
If your app will have authenticated users and admin users for the panel either by role or using a separate auth collection, remember to add those conditions to your read access function as well to gate the content.
Aha, I get what you mean now.
My understanding was wrong. I was expecting to see the Before
version, when After
version is not published
Ah! Sure, you could still have that but you'll need to modify the query to use an or
operator to allow the before to come through under the different conditions.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.