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

[5.x] Allow accessing drafts via the REST API with Live Preview #10229

Merged
merged 14 commits into from
Jun 25, 2024

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented May 30, 2024

Draft entries couldn't be viewed in Live Preview, even when the token query parameter was provided.

This PR fixes that by preventing the "entry published" check from happening if a valid Live Preview token is passed in the request.

Closes #10207.

src/Http/Controllers/API/ApiController.php Outdated Show resolved Hide resolved
tests/API/APITest.php Show resolved Hide resolved
@duncanmcclean duncanmcclean requested a review from jasonvarga May 30, 2024 18:10
@jasonvarga jasonvarga dismissed their stale review June 25, 2024 18:04

Changes were made

@jasonvarga
Copy link
Member

This works, but feels a bit inconsistent. I know we chatted about this in Slack already and this is what we agreed on, but thinking about it a bit more now, I don't want to develop ourselves into an awkward situation later.

For instance I could see eventually allowing filters on the show route, or having the default filtering on the show route. It probably should already do that. e.g. "scheduled" entries aren't showed on the index route, but they are on the show route. You could argue that's a bug. If we "fixed" it then we'd have to factor in this drafts=true parameter as well.

I think we could just fix the live preview issue for now, as that's what it seems like the actual issue is at the moment.

@jasonvarga jasonvarga changed the title [5.x] Allow accessing drafts via the REST API [5.x] Allow accessing drafts via the REST API with Live Preview Jun 25, 2024
@jasonvarga jasonvarga merged commit d55ad71 into 5.x Jun 25, 2024
19 checks passed
@jasonvarga jasonvarga deleted the fix/visibility-of-drafts-via-api-entries-show-endpoint branch June 25, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't access individual drafts using REST API
2 participants