When selecting 'Revert' from the '/moderation' page, the reverted revision is drafted and the current published revision becomes un-published.
This is not expected behavior and does not match the previous 7.x-1.3 behavior.
Previously, when creating a new revision, the previous revision remains published and new revision is draft.
My expected behavior is that when reverting a previous revision, the revision is reverted in a drafted state as a forward draft of the previously published revision.
The importance of the forward revision is to maintain the integrity of any currently published content. Currently, reverting causes the state of the revision to vary (sometimes the reverted revision is published, sometimes it is drafted) and can cause data to become unpublished un-intentionally.
Because of this, I would consider this issue Major as it effects published content and can cause published content to become unpublished unintentionally.
Comments
Comment #2
mrgoodfellow CreditAttribution: mrgoodfellow commentedAfter some consideration I believe I have figured out the optimal workflow for the 'revert' button.
Current workflow:
When a revision is reverted, the previous published revision is unpublished.
Proposed Workflow (minor change)
When a revision is reverted, at the 'Are you sure you want to revert to the revision from..." page when you are presented with option to 'revert' or 'cancel' I would like to also present the editable contents of that revision.
That way, before the revision is completed, any necessary changes and the appropriate status can be applied.
This prevents users from attempting to access a node a recieving a 404 error during the time that the reverted (drafted) revision is edited and published.
Thoughts? Feedback? Any Idea where I get started or what function actually handles the revision submission page?
Comment #3
DamienMcKennaDrafty doesn't provide a UI, it comes from Workbench Moderation, so I've moved the issue over there.
Comment #4
mrgoodfellow CreditAttribution: mrgoodfellow commentedIn drupal core: node.pages.inc has the function: function node_revision_revert_confirm($form, $form_state, $node_revision) {
I was able to get the editable contents printed to the revert page by changing this function in core, but I was not able to determine a sufficient hook process to accomplish this using a custom module or patch to workbench moderation:
Update: I was able to find a hook to alter the form for revision confirmation. I need to finish this function so that it sufficiently revises the confirm_form in function node_revision_revert_confirm() to include any revised values. Still in progress
Comment #5
mrgoodfellow CreditAttribution: mrgoodfellow commentedUpdating to bug report as this is a change to workflow between 7.x-1.3 and 7.x-3.0
In 7.x-1.3 when creating a new revision the previous revision remains published and new revision is draft.
After updating to 7.x-3.0 the previous revision is unpublished.
Looking into this it appears the issue is that we are missing a flag to set the revision as a draft revision:
$entity->is_draft_revision = TRUE;
Trying to figure out the best place to hook this, it looks like it may need to be hook_entity_presave()
Any advice would be awesome as I'm digging into this issue!
Comment #6
mrgoodfellow CreditAttribution: mrgoodfellow commentedComment #7
mrgoodfellow CreditAttribution: mrgoodfellow commentedComment #8
mrgoodfellow CreditAttribution: mrgoodfellow commentedDigging into the actions of drafty that manage this function, it looks like the issue is in how the 'is_new' option is applied to that revision form. I was able to force all new revisions to a drafted (or published = 1) state by hooking into the hook_form_alter() function as follows:
Looking further into drafty it looks like the forward revision process is handled by: drafty_entity_is_new() which is called by drafty_entity_presave() which can be hooked into:
I tried to assign an is_new value with the hook_entity_presave() but was unable to get it to work properly:
For now I am going to apply '$node_revision->status = 1;' to force all revisions to a published state, although this is a temporary solution and not ideal.