LatestRevisionCheck does not check latest revision if it is published

Created on 18 May 2020, over 4 years ago
Updated 10 April 2023, over 1 year ago

Problem/Motivation

By default LatestRevisionCheck access check returns AccessResult::forbidden if entity has not pending revisions. But it does not check if currently checking revision is published one i.e does not perform isDefaultRevisionPublished check. As a result we have 'No pending revision for moderated entity.' message. Latest version can be not only draft but also published one.

How to reproduce

  1. Setup 2 languages
  2. Enable json:api module
  3. Enable default Editorial content moderation workflow
  4. Create node with default lang and publish it
  5. Translate node with another lang and remain it in draft
  6. Make a request to retrieve original node with rel:working-copy:
    http://drupal.local:8080/en/jsonapi/node/{node_type}/{node_uuid}?&resourceVersion=rel%3Aworking-copy

Proposed resolution

Add isDefaultRevisionPublished check into core/modules/content_moderation/src/Access/LatestRevisionCheck.php.

Remaining tasks


Add tests

User interface changes

API changes

🐛 Bug report
Status

Closed: works as designed

Version

9.5

Component
Content moderation 

Last updated 4 days ago

Created by

🇵🇱Poland dmitry.korhov Poland, Warsaw

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