"changed" should never be untranslatable

Created on 14 September 2020, over 4 years ago
Updated 19 April 2024, 8 months ago

Problem/Motivation

Under a particular condition, namely when the "Changed" field is marked as untranslatable, an EntityChangedConstraint violation can be triggered unexpectedly when working with content that has been translated and is in various moderation states.

Steps to reproduce

  1. Install standard profile.
  2. Install Content Moderation, Content Translation.
  3. Add the German language (doesn't matter which language).
  4. Enable Basic Content for translation using the default workflow.
  5. Enable translation for Basic Content under "Content language and translation", and mark the "Changed" field as untranslatable.
  6. Create a new English node in Draft and click Save.
  7. Edit the node again, set the moderation state to Published, and click Save.
  8. Edit the node again, set the moderation state to Draft, and click Save.
  9. Add a German translation of the node in Draft.
  10. Edit the German translation of the node, set the moderation state to Published, and click Save.
  11. Edit the German translation of the node, set the moderation state to Draft, and click Save.
  12. Edit the English translation of the node, in either Draft or Published (doesn't matter), and click Save.
  13. Confirm a EntityChangedConstraint validation error occurs with the message "The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved."
  14. Now, edit Basic Content's translation configuration so that the "Changed" field is translatable. Repeat the above steps for a new node and confirm you don't get a validation error.

The result of the above scenario is that it is now impossible to edit the English content, with no workaround identified thus far.

Proposed resolution

For content that is enabled for translation, while also enabled for moderation, enforce the "Changed" field to be translatable. In addition, if and when a fix is released, attempt to repair the database if necessary.

Remaining tasks

  • Add configuration override for moderated content which forces the content's changed field to be untranslatable.
  • Add an update hook to repair the database.

User interface changes

None so far.

API changes

None so far.

Data model changes

None so far.

Release notes snippet

None so far.

Snippet of node_field_revision demonstrating example

With the table in this state, when attempting to perform the last step of editing the english translation of the content, the check in EntityChangedConstraintValidator for unchanged entity (loaded straight from database) time > form save time compares (1600123463 > 1600123429), resulting in a validation error.

The value 1600123463 is pulled from english revision 23, in the table, which is the 2nd to last time the entity overall was saved (with the last two saves being the german translation, which generated revisions 23 and 24).

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
Content moderationΒ  β†’

Last updated 21 days ago

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

πŸ‡ΊπŸ‡ΈUnited States lpeabody

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024