WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 8 days ago

#31089 new enhancement

Customize: Add revisions and statuses for changesets

Reported by: westonruter Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Customize Keywords:
Focuses: ui, javascript Cc:

Description (last modified by westonruter)

In #30937 the concept of a “Customize Changeset” is introduced, wherein each Customizer session gets a changeset containing the settings that are modified and eventually saved (or not). The customize_changeset is a custom post type with the settings JSON stored in the post_content. Every time the Customizer is accessed, a new customize_changeset post is created with post_status=draft and then when saving it becomes post_status=publish. As such, this automatically becomes a revision history for all saved changes to the Customizer.

With the work on changesets, however, there is no UI for accessing these revisions. There is no way to see previous revisions, to revert a revision, to recall a revision to continue changes. Nevertheless, UIs for revisions and changeset status changes are being prototyped in the Customize Snapshots plugin.

I did do some work on a Settings Revisions plugin for a potential UI, where a new Customizer section is added to load a previous revision and to provide the “commit message” for the new one (see plugin screenshots). However, this plugin was written before changesets.

See also:
#21666 (Customizer reset/undo/revert)
#20692 (Handle unsaved changes in the customizer)
#28721 (Scheduled changes for the customizer)
#31088 (Post revisions in the customizer)
#38624 (Allow starter content to apply after a site has already been set up and is no longer “fresh”)
#22880 (Customize Themes without activation)
#39031 (Customize: Include theme as just another setting instead of passing as separate parameter)
#39896 (Customizer: Allow users to Draft changes before Publishing)

Change History (25)

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


2 years ago

#3 @westonruter
2 years ago

  • Description modified (diff)
  • Summary changed from Add revisions to the Customizer to Add revisions of settings to the Customizer

#4 @westonruter
2 years ago

This would be a good feature plugin, especially extending transactions in #30937 with a UI.

#5 @celloexpressions
15 months ago

Is this something that could be in scope for transactions or would it be better to build on after the underlying support is done? I'm envisioning adding a split dropdown arrow to the save & publish button that opens up options like scheduled changes and revisions, and other related things that transactions would enable.

#6 @westonruter
15 months ago

UI would be out of scope for transactions, but the underlying backend infrastructure would be in place with the introduction of transactions. A setting revisions plugin would be a good feature plugin to propose for Core inclusion after transactions are in place.

#7 @folletto
6 months ago

Just noting that the revision UI proposed in the Additional CSS feature in #35395 can be adapted and used to be a global versioning system instead of just for CSS. :)

#8 @westonruter
6 months ago

@folletto yes, Customize Changesets (#30937) actually result in a new revision of customizer settings for every publish. At the moment the changesets get automatically garbage-collected since there is no UI, but if a plugin adds revisions support to the customize_changeset post type, then published changeset posts will persist. Revision history for a given setting can then be extracted from those published customize_changeset posts.

#9 @westonruter
5 months ago

In 38810:

Customize: Implement customized state persistence with changesets.

Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.

#10 @folletto
5 months ago

At the moment the changesets get automatically garbage-collected since there is no UI, but if a plugin adds revisions support to the customize_changeset post type, then published changeset posts will persist. Revision history for a given setting can then be extracted from those published customize_changeset posts.

Ok, that's wonderful!

So would be worth if I do a mockup of a versioning panel that isn't CSS-specific but is valid for the whole Customizer? Is that something we'd like to build in a next release?

#11 @westonruter
5 months ago

  • Milestone changed from Awaiting Review to Future Release

@folletto yes! As part of this, I think the “Save & Publish” buttons should get split into two separate buttons, like “Save Draft” and “Publish” (or “Activate”). The Save Draft button would cause the changeset to be stored with a draft status instead of auto-draft so that it wouldn't get garbage-collected. So then I see revisions taking a few forms:

  • Previously-published changesets. These are changesets that have gone live previously, and thus provide _snapshots_ of changes that went live at a given time.
  • Changesets that have the draft, pending, or future status. These are essentially revisions that haven't gone live yet.
  • Post revisions of a given changeset. So if you save a draft of a changeset, and then continue to make changes and keep hitting Save Draft, each time you hit Save can cause a new post revision to be made. Since changesets can be edited by multiple people, revisions can indicate who made the changes and which settings were modified.

The Customize Snapshots feature plugin for WP 4.6 re-uses the edit post screen in the admin to show the contents of a snapshot (changeset) and also shows the core revisions UI for showing changes between the revisions. Since the post_content is a pretty-printed JSON blob, it shows “nicely” in the diff view (if not user-friendly).

The Customize Snapshots plugin also provides a UI for scheduling a snapshot for the future, for submitting a snapshot as Pending (if the user lacks publish_posts cap), and also for providing a name/title for a given snapshot (like a commit message).

So yeah, I think what is needed is a UI for managing the changesets. For listing out existing changesets, the revisions of a changeset, and also a UI for transitioning a changeset post from auto-draft to draft, pending, or future.

#12 @westonruter
5 months ago

@folletto something related to this is a shortcut to show the diff of the changes for the current customizer session (the active changeset). In other words, “If I hit Publish what specifically are the changes that will go live?” This UI could be accessed by locating the current changeset in the list of all the changesets, if there is such a list. But it could be particularly useful if all of the controls with dirty settings would get some visual indicator that they are modified, and perhaps even a UI to revert the change. This could also then tie into some concurrency locking (#31436) in the customizer, where if two users are editing the same changeset, a UI could be shown which marks a control as being locked or that it has a value supplied from another, and maybe a UI to show a diff. Some related issues from the Customize Snapshots plugin:

#13 @celloexpressions
5 months ago

I think we should look at adding a generic button to show more publishing icons, and that could toggle a slide-down section that incorporates drafts, revisions, scheduled changes, etc. I'm thinking a split-button with an arrow on the right of save and publish would work, similar to what Press This does.

#14 @folletto
5 months ago

Messages received. I'll try to push out a draft design concept to discuss. :)

#15 @westonruter
5 months ago

  • Description modified (diff)

@folletto closely related to #38624 (Allow starter content to apply after a site has already been set up and is no longer “fresh”)

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


4 months ago

#17 @westonruter
4 months ago

  • Description modified (diff)
  • Summary changed from Add revisions of settings to the Customizer to Customize: Add revisions and statuses for changesets

Also, once a changeset has transitioned from auto-draft to another non-transient status, such as draft, pending, or future, the “are you sure” beforeunload dialog should not be shown, as is being implemented in the Customize Snapshots plugin. (See #39229.)

Last edited 4 months ago by westonruter (previous) (diff)

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


2 months ago

#19 @celloexpressions
2 months ago

  • Focuses ui added

@folletto when you get a chance (and others) it would be good to see your thoughts on potential UI for this, since it's a shorter-term priority to implement.

#20 @folletto
2 months ago

I paused this since there was an agreement in getting in sync revision UI for both Editor and Customizer, and we can't thus proceed until we have the first visuals for the Editor work.

#21 @westonruter
2 months ago

For discussion on revisions for CSS changes, see also #38707.

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


8 weeks ago

#23 @westonruter
8 weeks ago

  • Description modified (diff)

#24 @westonruter
6 weeks ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


8 days ago

#26 @westonruter
8 days ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.