Skip changing 'revision translation affected' field if the old revision is syncing

Created on 1 February 2023, almost 2 years ago

Problem/Motivation

We need to skip recalculating of the revision translations if the entity is syncing and the existing revision is updated instead of creating a new one.
Useful for content import, migration, hook_update_N(), when we need to keep the revision_translation_affected field value for the old revisions.
Otherwise, it can break the list of revisions, e.g. /node/{nid}/revisions. This happens because ContentEntityStorageBase::populateAffectedRevisionTranslations() updates this field for all translations of the entity.

The issue could be as a second part of the ✨ Mark an entity as 'syncing' during a migration update Needs work . That issue fixed the synchronization process for the revision migration. This one must fix an extra bug related to the revision_translation_affected base field.
But in general, it seems to have been missed in the ticket #2803717: Allow 'syncing' content to be updated in content moderation without forcing the creation of a new revision β†’ .

Steps to reproduce

A simple situation:

  • D9/10 site with minimum two languages. E.g. EN and FR.
  • Content type News with Publishing option: Create new revision.
  • Certain node was created and updated with scenario:
    • Created the node - EN lang - revisions id 1
    • Created a translation - FR lang - revisions id 2
    • Updated the node - EN lang - revisions id 3
    • Updated the node - FR lang - revisions id 4
    • Updated the node - EN lang - revisions id 5
  • In the result the /node/{nid}/revisions will show only the language-related revisions: 3 revisions for the EN lang and 2 for the FR
  • We added a new field Field A that related from the other.
  • We want to set the field for all old revisions according to some conditions.
  • To set the field we can use migration and entity_revision destination plugin or hook_update_N(). In both cases, the code $entity->setNewRevision(FALSE); $entity->setSyncing(TRUE); must be used.
  • As a result, we can see that the value of the new Field A has been added to each revision, but the revision page /node/{nid}/revisions

Proposed resolution

We have to make a solution that will allow skipping the updating of the revision_translation_affected for the old revisions and when we use the synchronization process.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

It's good to use together with ✨ Mark an entity as 'syncing' during a migration update Needs work when we need it for the migration.

πŸ› Bug report
Status

Active

Version

10.1 ✨

Component
Content moderationΒ  β†’

Last updated 17 days ago

  • Maintained by
  • πŸ‡¦πŸ‡ΊAustralia @Sam152
Created by

πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024