-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Disable autosave endpoints for Templates and Template Parts #7254
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
Disable autosave endpoints for Templates and Template Parts #7254
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
@swissspidy, I used the old Trac ticket as a reference. Should I create a new one? |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
It looks like an attempt was made to make the autosaves endpoint work for Templates and Template Parts (https://core.trac.wordpress.org/ticket/56922). These PHP unit tests are failing now. How do we want to proceed here? Should we disable the PHP unit tests until these post types fully support autosaving? Note: The autosaving is disabled on the client side - WordPress/gutenberg#64733. |
Yes. New milestone/release = new ticket. The old ticket is already fixed on a closed milestone and must not be reopened/amended for changes in a new milestone.
I suppose we have to make up our minds here :-) Just so I understand correctly: [56819] added proper autosave support for But the editor never actually supported autosaves for If the former, we should update the core code here accordingly. If the latter, we should update Gutenberg, because it apparently seems to be supported by core. So, which one is it? |
|
Based on the latest comments on 56922 and new ticket, it seems that autosaves aren't fully working for Templates and Template Parts. |
|
That one is labelled as an enhancement though, just updating the regex and adding some hardening. |
|
The template parts and autosave endpoint still generate a warning. One I'm trying to fix in Gutenberg PR. In any case, let's see what others think about this. |
Correct. This is an enchancement and not a blocker.
I'm looking into the issue, @Mamaduka.
@swissspidy, I believe it’s the latter, as the default autosave endpoint doesn’t work for templates and template parts due to their different URL structure. These custom autosave and revision endpoints were supposed to address this issue, but as it can be seen, they didn’t fully resolve it. I suggest to wait for the Core fix to arrive and avoid disabling autosaves for templates and template parts, unless there are other reasons to do so for these post types. |
|
I've fixed the issue with the autosaves endpoint. @Mamaduka, if you don't mind, I'm going to create a new Trac issue for this bug, as https://core.trac.wordpress.org/ticket/41172 doesn't seem to be an exact fit. |
|
Thank you, @anton-vlasenko! |
|
Core ticket: https://core.trac.wordpress.org/ticket/61970 The PR is ready for review. The error occurs because the Editor is trying to fetch autosaves for a file-based template. Since file-only templates do not have any entities in the database, it is impossible to fetch autosaves (or revisions) for them. My PR addresses this issue by changing the REST response code from 403 to 400 when the controller attempts to get autosaves (revisions) for a file-only template (template part) and also fixes the fatal PHP error. I would appreciate your review and approval, @Mamaduka and @swissspidy. This PR resolves the fatal error issue, but it will not enable autosaves automatically. |
|
Closing in favor of #7272. |
These two post types were missing while working on the original ticket.
Gutenberg issue: WordPress/gutenberg#64733.
Trac ticket: https://core.trac.wordpress.org/ticket/41172
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.