Problem/Motivation
When you publish an existing revision as the default one, revision_default
field should be set to TRUE
.
Not doing so could lead to odd states for instance, after publishing a workspace, menu items seem to get stuck on having pending revisions.
The relevant bit of code here is MenuLinkContentStorage->getMenuLinkIdsWithPendingRevisions()
which looks at the menu_link_content_revision
table and see’s that the revision_default
column is set to 0
for the highest revision ID. That seems to be what is disabling some menu UI functionality.
Steps to reproduce
- Enable workspaces on a clean install.
- Switch to stage.
- Add a basic page and click "Provide a menu link" and then save.
- Publish the Stage content.
- Goto
admin/structure/menu/manage/main
and you should see a warning:
Main navigation contains 1 menu link with pending revisions. Manipulation of a menu tree having links with pending revisions is not supported, but you can re-enable manipulation by getting each menu link to a published state.
Proposed resolution
The crux seems to be on line 617 of ContentEntityStorageBase::doSave()
where it checks && $entity->isNewRevision()
. We don’t get promoted to the revision_default
here since workspaces is publishing an existing revision.
It seems that content_moderation is creating new revisions all the time, so a new "published" revision always gets revision_default
set to TRUE
.
I think workspaces should do the same, even though we are marking an older revision as default, for all intents and purposes that revision should be seen by the system as a "new default revision".
Remaining tasks
- Validate
- Review