Skip to content
Snippets Groups Projects

Issue #3089747: Content moderation can wrongly set old revisions as default when they're resaved

Open Issue #3089747: Content moderation can wrongly set old revisions as default when they're resaved
1 unresolved thread
Open Luis Ruiz Peidró requested to merge issue/drupal-3089747:drupal-3089747 into 11.x
1 unresolved thread

Merge request reports

Members who can merge are allowed to add commits.

Merge request pipeline passed for 383ad2e6

Approval is optional
Code Quality is loading
Ready to merge by members who can write to the target branch.

Merge details

  • The source branch is 3204 commits behind the target branch.
  • 1 commit and 1 merge commit will be added to .
  • Source branch will not be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
88 94 $node->getTranslation($langcode)->$name = $value;
89 95 }
90 96 }
97 $node->setSyncing($syncing);
  • I'm half wondering if we have to restore the original syncing state here. It's my understanding that mutating the state here would follow the node around for the remainder of the request.

    Definitely need an Entity API expert to chime in.

  • setSyncing is the right state in this case, so I think we should leave in this state, please see the change record https://www.drupal.org/node/3052114

    New revisions are created every time an entity or revision is updated, if that entity is being moderated with content moderation. Previously there was no way to opt out of this. By using SynchronizableInterface, users can now mark an entity as 'syncing' to indicate changes are being made to the entity which do not reflect a typical content/editorial field based change and thus should not be subject to the entity lifecycle rules content moderation enforces.

  • I think I didn't phrase that well enough. Consider this:

    In _node_mass_update_helper

    $node->setSyncing(TRUE);

    ...later on in another module's hook that fires after content moderation

    $node = some_function_that_loads_the_same_node();
    $node->set('field_x');
    $node->save();  <-- Will the syncing flag set in the content moderation hook apply here?  Is that flag statically cached in the request along with the rest of the entity?

    ...or to make it safer, would we have to do this in _node_mass_update_helper:

    $original_state = $node->isSyncing();
    $node->setSyncing(TRUE);
    $node->save();
    $node->setSyncing($original_state);

    in order to prevent the syncing status from "leaking out" into the rest of the request?

  • Please register or sign in to reply
  • added 1 commit

    • 42915468 - Issue #3089747: Content moderation can wrongly set old revisions as default when they're resaved

    Compare with previous version

  • added 1 commit

    • 63a179a4 - Issue #3089747: Content moderation can wrongly set old revisions as default when they're resaved

    Compare with previous version

  • added 131 commits

    Compare with previous version

  • eduardo morales alberti mentioned in merge request !4713

    mentioned in merge request !4713

  • Please register or sign in to reply
    Loading