Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#53072 closed enhancement (fixed)

Enable revisions for the reusable block custom post type

Reported by: matveb's profile matveb Owned by: desrosj's profile desrosj
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch has-screenshots has-unit-tests commit needs-codex has-dev-note
Focuses: Cc:


Let's enable post revisions for the wp_block custom post type.

This has not been pursued yet in suspense of broader improvements to block management, reusable blocks, and editorial flows. However, there's really no reason to lock this functionality out in the meantime, which can be very useful today for people.

Also reported

Attachments (1)

reusable-block-with-revisions.png (48.7 KB) - added by matveb 3 years ago.
Sidebar with revisions enabled

Download all attachments as: .zip

Change History (18)

This ticket was mentioned in PR #1205 on WordPress/wordpress-develop by mtias.

3 years ago

  • Keywords has-patch added

#2 @youknowriad
3 years ago

  • Milestone changed from Awaiting Review to 5.8

3 years ago

Sidebar with revisions enabled

#3 @audrasjb
3 years ago

  • Keywords has-screenshots commit added

Ah! Thank you for opening this ticket, I completely support this proposal.

The pull request works great on my side.

Marking for commit action.

#5 @desrosj
3 years ago

  • Keywords commit has-unit-tests removed

It looks like the PR has a unit test failure that needs to just be fixed before this can be committed.

Also, it looks like the branch was pushed directly to the mirror repository. @matveb for future reference, because wordpress-develop is a mirror, any changes to that repo not found in SVN get overwritten when the repo syncs (I believe this happens every few minutes), so looks like while your PR is still open, your branch is now gone. It's best to open a PR from your fork to prevent that.

I've created a fresh PR on my fork with an update that should make the unit tests pass.

One question I had was when a revision would actually be created for a reusable block. I did some testing and it seems a revision is only created when the block is actually saved (which is good).

#6 @desrosj
3 years ago

  • Keywords has-unit-tests added

Did not mean to remove has-unit-tests.

#7 follow-up: @matveb
3 years ago

@desrosj Ah, good to know! I was trying that flow since I've never used it before for patches :)

Yes, it should only commit revisions upon saving, and the saving flow for reusable blocks is not dependant on the post that may harbor it.

To test, also go to edit the reusable block directly via "manage reusable blocks" and the selecting it from the list. Both saving flows should work.

#8 in reply to: ↑ 7 @audrasjb
3 years ago

Ah yes, indeed thanks @desrosj good catch. I directly tested the code, I didn't try to apply the PR.

Replying to matveb:

To test, also go to edit the reusable block directly via "manage reusable blocks" and the selecting it from the list. Both saving flows should work.

Or go directly to /wp-admin/edit.php?post_type=wp_block

#9 @desrosj
3 years ago

  • Keywords commit added

To clarify my concern, I just wanted to confirm that there were no autosaves of reusable blocks happening that were triggering many revisions.

Looks like the tests are good now! Feel free to commit, @matveb.

desrosj commented on PR #1205:

3 years ago

Replaced by #1206.

#11 @desrosj
3 years ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 50835:

Posts, Post Types: Enable revisions for the wp_block post type.

This allows site owners to take advantage of revisions while broader improvements to block management and reusable blocks are explored.

Props matveb, audrasjb, desrosj.
Fixes #53072.

#14 @desrosj
3 years ago

It looks like I missed the resulting change for the test fixtures needed in [50835]. These were included in [50836].

This ticket was mentioned in Slack in #core by desrosj. View the logs.

3 years ago

#16 @milana_cap
3 years ago

  • Keywords needs-dev-note needs-codex added
Note: See TracTickets for help on using tickets.