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] Fix broken revision links on unpublished entries #10330

Merged

Conversation

faltjo
Copy link
Contributor

@faltjo faltjo commented Jun 19, 2024

Fixes: #10331

When clicking on the 'View History' button of an unpublished entry in the CP, the revision history panel loads indefinitely.
The called route cp/collections/{collection}/entries/{entry}/revisions fails with error 500.

Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: statamic.cp.collections.entries.revisions.show] [URI: cp/collections/{collection}/entries/{entry}/revisions/{revision}] [Missing parameter: revision].

Apparently the working copy of the entry included in the entry's list of revisions has no id, as it is not associated with another revision. But this id is necessary to create a link in the list of revisions.

Using an empty link fixes this problem, as the working copy only exists locally and no revision shall be showed on click anyway.

Note: I was not able to find any tests of the EntryRevisionsController so I adapted a test related to this use-case. Feel free to shift it to the correct location.

See also: #10057

Copy link
Member

@duncanmcclean duncanmcclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request!

I've tweaked the if statement and added a test for the "revisions index" endpoint to make sure it works as expected. 👍

@jasonvarga jasonvarga merged commit d477721 into statamic:5.x Jun 20, 2024
16 checks passed
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.

Revision history panel of unpublished entries loads indefinitely
3 participants