Problem/Motivation

The revision system doesn't enforce writing a revision log message. Even if we'd enforce it, there would be no guarantee the message would be meaningful (take Git commit messages for comparison...) - It's thus very complicated to understand what exactly was changed and what type of information was modified: is it content? Is it metadata? Is it both?

Currently, the only way to try and understand what happened between revisions is to install the diff module and compare revisions. This is better than the default core behavior, but is still not acceptable because you shouldn't have to randomly pick 2 revisions to compare and understand changes, either in content or metadata, or both. This is time-consuming, unintuitive and frustrating.

Proposed resolution

  • Determine if we should stop creating new revisions when only metadata was changed. This would need us to dramatically change the way we understand 'revisions' (better understood by software engineers) and consider them to be 'page history' for content instead (better understood by content authors). Metadata would thus have no business being mixed with content changes - This would need us to think about a way to track metadata changes one way or another, still.
  • Create a new column at node/NID/revisions such as it's immediately obvious what was changed. This can be at a high-level only, and would point people to 'revisions' that would make sense to compare only. E.g. when you're trying to understand who or when was changed the node author on a node. A good module to seek inspiration from would be revision_log_default.
  • Determine if we could then have a dropdown/select to filter out revisions by metadata changes or content changes. This would really only work if we'd differentiate both conceptually instead of seeing revisions as 'everything that was changed since the last node save'.

Remaining tasks

Discuss and come up with a solution.

User interface changes

TBD.

API changes

TBD.

Data model changes

TBD.

Comments

anavarre created an issue. See original summary.

timmillwood’s picture

Issue tags: +Workflow Initiative

I think the issue we need to address first is, what is metadata?

In a content entity we don't differentiate between what is a "content" field and what is a "metadata" field.

Ideally I feel we should create a revision for every single change of a content entity, although metadata should not be part of a content entity. The definition of metadata is "a set of data that describes and gives information about other data" therefore it should be be a separate thing, a separate object, a separate entity. We should introduce a MetaEntity or MetadataEntity alongside ContentEntity and ConfigEntity. The MetaEntity is non-revisionable and relates to the ContentEntity as a whole rather than a particular revision. It can be updated without changing or adding a revision to the ContentEntity. The ContentEntity will always get a new revision and may or may not update the MetaEntity.

amateescu’s picture

@timmillwood, we actually do have a way to differentiate metadata fields, they are the ones specified in the revision_metadata_keys annotation key.

If we also add #2862574: Add ability to track an entity object's dirty fields (and see if it has changed) to the mix, we will be able to easily know if only a revision metadata field was changed and not force a new revision in that case :)

timmillwood’s picture

The revision_metadata_keys should create new revisions when changed. I think this issue relates to entity wide metadata.

I wonder if we could enforce that new revisions are only created when revisionable fields have been updated.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

timmillwood’s picture

Component: content_moderation.module » entity system

I'm not sure this is strictly a Content Moderation issue.

hchonov’s picture

Ideally I feel we should create a revision for every single change of a content entity

@timmillwood, this depends on the system. You might have a complex workflow and creating a new revision might force you to go through the workflow chain and if you want to simply fix a typo you would prefer to skip that. It always depends on the system and in our we have a check which always creates a new revision if an entity has been modified - ideally you would need #2862574: Add ability to track an entity object's dirty fields (and see if it has changed) like @amateescu pointed out, but we use CEB::hasTranslationChanges() for that in a combination with the patch from #2838602: [PP-2] Optimize CEB::hasTranslationChanges by caching its result and serving subsequent calls from the result cache - big performance boost so that we don't slow down the saving process.

@anavarre, it would be nice if you tell us what exactly do you mean by metadata.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.