Summary

Since Drupal 11.1, the changed timestamp is no longer updated when using the "Publish Latest Revision" bulk action. The content is published correctly, but the changed date retains its previous value.

Root cause

In Drupal 11.1.0, the behavior of setSyncing(TRUE) was changed to explicitly preserve the original changed timestamp on save (see Change Record #3250104).

In AdminModeration::publish() (line 167), the code calls:

$this->entity->setSyncing(TRUE);

Prior to Drupal 11.1, this did not prevent the changed field from being automatically updated. Now it does, which means bulk-published content keeps its old changed date.

Affected methods

AdminModeration::publish() — line 167
AdminModeration::unpublish() — line 92 (same issue applies)

Note: AdminModeration::archive() already has setSyncing(TRUE) commented out (line 257), so it is not affected.

Suggested fix

Explicitly set the changed timestamp before saving:

$this->entity->setChangedTime(\Drupal::time()->getRequestTime());

This should be added before the $this->entity->save() call in both publish() and unpublish() methods. This preserves the setSyncing(TRUE) behaviour for other purposes while ensuring the changed date reflects when the action was performed.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andy_w created an issue. See original summary.

andy_w’s picture

Status: Active » Needs review

joseph.olstad’s picture

Very good, thank you for this important fix! I'll tag and release shortly.

joseph.olstad’s picture

Version: 2.0.x-dev » 3.0.x-dev

This might also be needed for 3.0.x, I'll check now.

joseph.olstad’s picture

Version: 3.0.x-dev » 2.0.x-dev
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

joseph.olstad’s picture

Status: Fixed » Closed (fixed)

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