Problem/Motivation
Spin off from #2761409: The latest revision isn't always the current revision.
Currently the only UI for changing the current revision in core, is the 'revert' functionality on the revisions tab.
While this says 'revert', what it actually does is:
1. Load an old revision
2. Save it as a new, current revision
The old revision is left completely intact and unchanged, as it the one being reverted from.
This allows modules that need to consult $entity->original, react to entity saving hooks etc. to behave the same as if the entity had just been edited without new content, it also preserves the revision-to-revision history (i.e. if you revert a revert, that'll also create a new revision, so you can see what the entity looked like at any given point).
However, it's not really 'reverting' - it would also work completely fine for forward revisions too.
Tim Millwood also brought up being able to set the current revision without creation a new one. This would be a lot less involved than the current code - since you'd just change where the pointer is to rather than loading and saving as a new one. I think the advantages of the current system outweigh the simplicity of this though, since not allowing entity hooks to fire could run into data-integrity issues.
Proposed resolution
1. Decide whether the current behaviour is OK or not.
2. Decide whether the language of 'reverting' and 'setting as current' adequately describes what happens to end users.
Comments
Comment #2
moshe weitzman CreditAttribution: moshe weitzman at Acquia commentedI agree that the current behavior is safest for core. Maybe some Contrib code can tackle the 'just move the pointer to anther revision'.
The only other wording I can think of instead of 'revert' is 'Publish'. This makes sense because you are making an existing revision the published revision. Its a bit confusing thugh since the revision might have a status=0 which we usually call unpublished.
Comment #3
timmillwood"published" won't work because the revision you're setting to be the current revision may not be published.
Comment #4
catchYep, gets confusing when this happens.
Another option might be 'Set live' or 'Set as the live revision' - one advantage is this works both for forward and backward revisions, and site builders may already be familiar with the concept of a 'live' site (as opposed to dev/staging).
Comment #5
Gábor HojtsyWell, making a new copy of the revision allows us to have an audit trail no? How would we have an audit trail if there is not a new revision?
Comment #6
moshe weitzman CreditAttribution: moshe weitzman at Acquia commented@Gabor - correct.
'Set as live revision' works well as UI text. But I'm a little uneasy about the term 'live revision'. That would show up in code, developer docs, etc. I think 'Set as active revision' is a bit more natural IMO
Comment #7
catch@Gabor yes exactly, there's no audit trail if we allow switching between multiple revisions, I think we just need to improve how we communicate it.
'active' feels like it has the potential to be ambivalent once we get to workspaces etc. At that point, when you're in a workspace the non-live revision could be 'active' (i.e. that's what you're viewing and editing based on), but it still won't be 'live'.
Comment #9
Bojhan CreditAttribution: Bojhan as a volunteer and commentedCan anyone describes this in terms of user stories/scenarios?
Comment #14
mrgoodfellow CreditAttribution: mrgoodfellow commentedI would love to have the option to edit the content of the node prior to reverting, that way any changes can be made when publishing. Currently when reverting with Workbench Moderation we have a workflow issue where the revision is in a drafted state and the page is no longer available to external users. I would like to be able to either be able to draft a new revision and have the previous revision remain published OR have a way to edit the content of the revision before publishing the changes.
Ideally I could hook the editable contents of the revision at the page that propts: Are you sure you want to revert to the revision from...
then changes can be pushed before publishing. I think there may be a pre-save but I'm not sure how I can hook into this page properly.
I'm using workbench moderation with drafty.