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 incorrect revision edit URLs #10057

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/js/components/revision-history/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
readOnly: true,
method: 'patch',
action: 'update',
itemUrl: `${this.revision.attributes.id}/revisions/${this.revision.id}`,
itemUrl: this.revision.attributes.item_url,
}
},

Expand Down
4 changes: 4 additions & 0 deletions routes/cp.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@
Route::resource('revisions', EntryRevisionsController::class, [
'as' => 'collections.entries',
'only' => ['index', 'store', 'show'],
])->names([
'index' => 'collections.entries.revisions.index',
'store' => 'collections.entries.revisions.store',
'show' => 'collections.entries.revisions.show',
]);

Route::post('restore-revision', RestoreEntryRevisionController::class)->name('collections.entries.restore-revision');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ public function index(Request $request, $collection, $entry)
->revisions()
->reverse()
->prepend($this->workingCopy($entry))
->filter();
->filter()
->each(function ($revision) use ($collection, $entry) {
$revision->attribute('item_url', cp_route('collections.entries.revisions.show', [
'collection' => $collection,
'entry' => $entry->id(),
'revision' => $revision->id(),
]));
});

// The first non manually created revision would be considered the "current"
// version. It's what corresponds to what's in the content directory.
Expand Down
Loading