Doesn't work with arbitrary revisions with Content Moderation

Created on 7 April 2021, over 3 years ago
Updated 23 July 2024, 4 months ago

Problem/Motivation

With core's Content Moderation module enabled, entities such as nodes can have multiple revisions. Where this intersects with this module is the case where a node has a draft revision, that is, an unpublished revision that is newer than the published revisions, like this:

- revision 3 - unpublished
- revision 2 - unpublished
- revision 1 - published

In this example, the path /node/ID/latest shows revision 3, and with the AU token, this can be visible to anon users.

The path node/971/revisions/2/view shows revision 2, but even with the AU token, this is not visible to anon users.

The problem appears to be that on the node/971/revisions/2/view path, access_unpublished_entity_access() gets an $entity that reports to be published, with revision ID 1, rather than 2.

I'm not sure what's going on here. Core's NodeRevisionAccessCheck is correctly checking access on the right revision, so I don't know why by the time hook_entity_access() gets invoked, it's the active revision.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

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