Moderation state can be Published while entity status remains 0

Created on 22 February 2024, 9 months ago
Updated 26 June 2024, 5 months ago

Problem/Motivation

When content is scheduled to be published in the future, it is not allowed to be manually saved as published (status = 1). However, when setting the Moderation state to a published state, that moderation state gets saved, but the content status remains 0 (or unpublished). The Scheduler module prevents content to get status = 1 as long as there is a future publish_on date set.

Also see the related Scheduler issue Allow manual publish before future publish date Allow manual publish before future publish date Active where the preventing of getting manually published is being questioned.

Steps to reproduce

  1. Create content as with un unpublished moderation state (e.g. Concept) and set a future publish_on date
  2. Edit said content and set the moderation state to a published state (e.g. Published)
  3. Note that the moderation state is now Published, but the content status remains 0 (or unpublished) and will not be publicly visible.

Proposed resolution

Make sure the moderation state can't be Published as long as the content is not published. This module should do some final check to make sure the content hasn't been altered to get status = 0 by any event subscriber or hook before allowing the moderation state to be saved as Published.
FYI the scheduler module is resetting the published state to 0 in an entity_presave hook.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇧🇪Belgium fernly

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024