Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#57704 new enhancement

Add revisions to the links of the template and template part REST endpoint

Reported by: andraganescu's profile andraganescu Owned by:
Milestone: 6.3 Priority: normal
Severity: minor Version:
Component: REST API Keywords: needs-patch
Focuses: Cc:

Description

Because templates and template parts are just custom post types we already have revisions saved for them. Being able to access and use the revisions screen for templates and template parts in block themes therefore seems a low hanging fruit enhancement.

In https://github.com/WordPress/gutenberg/pull/45215 a first step to use this available feature has been taken - to simply display a button that sends the user to the revisions management screen.

To be able to achieve this, however, the API requires a decoration of the template controller with links that hold the revision count and previous revision, because of this bug in https://core.trac.wordpress.org/ticket/56922

To port this change to core we need to bring this decoration over, either via a solution similar to the one merged in Gutenberg or via the solution explored in https://core.trac.wordpress.org/ticket/56922

Change History (3)

#1 @flixos90
4 months ago

@andraganescu Is this necessary for 6.2? Since the Gutenberg PR was merged just 5 days ago and we are past the beta cut off for enhancements, I am not sure it's a good idea to introduce significant REST API changes at this point; particularly as even that Gutenberg code was marked as experimental.

I would suggest to move this to the 6.3 milestone for consideration. cc @hellofromTonya

#2 @andraganescu
4 months ago

  • Priority changed from high to normal
  • Severity changed from normal to minor

Hi @flixos90,

A problem I have is in the Gutenberg PR a bug was uncovered in the REST API - so it depends on how we look at it - is it an enhancement of the editor brought by offering that button to users, or is it also a bug fix in the template rest API endpoints?

It is not a must have, it is definitely a nice to have in 6.2, nothing will break if this does not land. On the other hand it is such a low hanging fruit enhancement, received with such positive feedback, that we may want to try and see if it is possible to land it in 6.2.

It is clear that if we can add the proper bug fix to the REST API in 6.2, either by porting the PHP solution in the Gutenberg PR or by implementing a more thorough fix as seen in https://core.trac.wordpress.org/ticket/56922, the porting of the code to show the button is pretty harmless even as we're past the cutoff for enhancements.

I will say that I fully understand a decision to skip for multiple reasons:

  • I may not have a full understanding of scope of updates in the REST API
  • I am about to open a ticket about that Gutenberg PR itself, which only adds even more work (the links in the revisions editor don't go back to the editor)
  • It's only a nice to have :)

Yet, it is possible and nice to have :)

#3 @andraganescu
4 months ago

  • Milestone changed from 6.2 to 6.3

With #57709 moved to 6.3 due to having to deal with a new shape of edit links in WP admin, this should also move to the next release.

Note: See TracTickets for help on using tickets.