Currently when a piece of content is moderated via the EntityModerationForm, the revision author is set to the current user, but the revision creation time is not set.

Proposed resolution

Update the revision creation time during form submit, and add a test.

Remaining tasks

User interface changes

API changes

Data model changes

Members fund testing for the Drupal project. Drupal Association Learn more


jhedstrom created an issue. See original summary.

jhedstrom’s picture

Issue tags: +Workflow Initiative
jhedstrom’s picture

Status: Active » Needs review
1.07 KB

This patch provides the test that makes the current behavior explicit.

jhedstrom’s picture

Chatted with Tim on slack and he was thinking this wasn't intentional behavior. This patch reverses the test and updates the revision creation time.

jhedstrom’s picture

Issue summary: View changes
amateescu’s picture

The patch looks good, just a minor change needed:

+++ b/core/modules/content_moderation/src/Form/EntityModerationForm.php
@@ -132,6 +132,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
+      $entity->setRevisionCreationTime($this->getRequest()->server->get('REQUEST_TIME'));

Let's use the time service here :)

timmillwood’s picture

Status: Needs review » Needs work

Apart from #6, looks good to me.

jhedstrom’s picture

Status: Needs work » Needs review
2.5 KB
3.48 KB

The time service makes things much easier :)

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Doesn't it? :D

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!

  • catch committed 839d67f on 8.5.x
    Issue #2922018 by jhedstrom, amateescu: Set revision creation time when...

  • catch committed f519bff on 8.4.x
    Issue #2922018 by jhedstrom, amateescu: Set revision creation time when...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.